tooltipSelector for showing tooltip with enum string.

This commit is contained in:
Tanasart 2023-09-05 20:31:36 +02:00
parent 1907b33d80
commit ef215cf344
17 changed files with 335 additions and 138 deletions

View file

@ -194,6 +194,7 @@
{"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",},
{"name":"widget","order":3,"path":"folders/VCT/widget.yy",},
{"name":"widgets","order":5,"path":"folders/widgets.yy",},
{"name":"tooltip","order":42,"path":"folders/functions/tooltip.yy",},
],
"ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
@ -595,6 +596,7 @@
{"name":"node_random_shape","order":17,"path":"scripts/node_random_shape/node_random_shape.yy",},
{"name":"s_node_random","order":3,"path":"sprites/s_node_random/s_node_random.yy",},
{"name":"sh_3d_extrude_filler","order":8,"path":"shaders/sh_3d_extrude_filler/sh_3d_extrude_filler.yy",},
{"name":"quarternionBox","order":32,"path":"scripts/quarternionBox/quarternionBox.yy",},
{"name":"s_window_exit","order":2,"path":"sprites/s_window_exit/s_window_exit.yy",},
{"name":"s_node_color_remove","order":7,"path":"sprites/s_node_color_remove/s_node_color_remove.yy",},
{"name":"sh_average","order":7,"path":"shaders/sh_average/sh_average.yy",},
@ -1144,7 +1146,6 @@
{"name":"node_image_sequence","order":1,"path":"scripts/node_image_sequence/node_image_sequence.yy",},
{"name":"node_text_file_read","order":7,"path":"scripts/node_text_file_read/node_text_file_read.yy",},
{"name":"node_pb_box_divide_grid","order":7,"path":"scripts/node_pb_box_divide_grid/node_pb_box_divide_grid.yy",},
{"name":"draw_tooltip","order":13,"path":"scripts/draw_tooltip/draw_tooltip.yy",},
{"name":"panel_preview_onion_setting","order":7,"path":"scripts/panel_preview_onion_setting/panel_preview_onion_setting.yy",},
{"name":"d3d_cylinder","order":2,"path":"scripts/d3d_cylinder/d3d_cylinder.yy",},
{"name":"sh_palette_replace","order":45,"path":"shaders/sh_palette_replace/sh_palette_replace.yy",},
@ -1506,6 +1507,7 @@
{"name":"o_dialog_preference","order":7,"path":"objects/o_dialog_preference/o_dialog_preference.yy",},
{"name":"node_wrap","order":2,"path":"scripts/node_wrap/node_wrap.yy",},
{"name":"__node_3d_prim_sphere","order":3,"path":"scripts/__node_3d_prim_sphere/__node_3d_prim_sphere.yy",},
{"name":"tooltip_selector_object","order":1,"path":"scripts/tooltip_selector_object/tooltip_selector_object.yy",},
{"name":"dialog_management","order":2,"path":"scripts/dialog_management/dialog_management.yy",},
{"name":"draw_shapes","order":10,"path":"scripts/draw_shapes/draw_shapes.yy",},
{"name":"sh_surface_replace_fast_replace","order":3,"path":"shaders/sh_surface_replace_fast_replace/sh_surface_replace_fast_replace.yy",},

View file

@ -232,6 +232,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"tooltip","folderPath":"folders/functions/tooltip.yy",},
],
"IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
@ -425,6 +426,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_trophy.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_tunnel.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_undo.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_unit_angle.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_unit_ref.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_vct.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_vfx.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -1171,6 +1173,7 @@
{"id":{"name":"sh_flood_fill_thres","path":"shaders/sh_flood_fill_thres/sh_flood_fill_thres.yy",},},
{"id":{"name":"s_node_random","path":"sprites/s_node_random/s_node_random.yy",},},
{"id":{"name":"sh_3d_extrude_filler","path":"shaders/sh_3d_extrude_filler/sh_3d_extrude_filler.yy",},},
{"id":{"name":"quarternionBox","path":"scripts/quarternionBox/quarternionBox.yy",},},
{"id":{"name":"s_window_exit","path":"sprites/s_window_exit/s_window_exit.yy",},},
{"id":{"name":"d3d_gizmo_sphere","path":"scripts/d3d_gizmo_sphere/d3d_gizmo_sphere.yy",},},
{"id":{"name":"s_node_color_remove","path":"sprites/s_node_color_remove/s_node_color_remove.yy",},},
@ -2214,6 +2217,7 @@
{"id":{"name":"node_wrap","path":"scripts/node_wrap/node_wrap.yy",},},
{"id":{"name":"__node_3d_prim_sphere","path":"scripts/__node_3d_prim_sphere/__node_3d_prim_sphere.yy",},},
{"id":{"name":"o_dialog_about","path":"objects/o_dialog_about/o_dialog_about.yy",},},
{"id":{"name":"tooltip_selector_object","path":"scripts/tooltip_selector_object/tooltip_selector_object.yy",},},
{"id":{"name":"dialog_management","path":"scripts/dialog_management/dialog_management.yy",},},
{"id":{"name":"draw_shapes","path":"scripts/draw_shapes/draw_shapes.yy",},},
{"id":{"name":"node_channels","path":"scripts/node_channels/node_channels.yy",},},

Binary file not shown.

View file

@ -2,87 +2,86 @@
if(OS == os_windows && gameframe_is_minimized()) exit;
#region tooltip
if(is_array(TOOLTIP) || TOOLTIP != "") {
if(is_struct(TOOLTIP) && struct_has(TOOLTIP, "drawTooltip")) {
if(is_struct(TOOLTIP)) {
if(struct_has(TOOLTIP, "drawTooltip"))
TOOLTIP.drawTooltip();
} else if(is_array(TOOLTIP)) {
var content = TOOLTIP[0];
var type = TOOLTIP[1];
} else if(is_array(TOOLTIP)) {
var content = TOOLTIP[0];
var type = TOOLTIP[1];
if(is_method(content)) content = content();
if(is_method(content)) content = content();
switch(type) {
case VALUE_TYPE.float :
case VALUE_TYPE.integer :
case VALUE_TYPE.text :
case VALUE_TYPE.struct :
case VALUE_TYPE.path :
draw_tooltip_text(string_real(content));
break;
case VALUE_TYPE.boolean :
draw_tooltip_text(printBool(content));
break;
case VALUE_TYPE.curve :
draw_tooltip_text("[" + __txt("Curve Object") + "]");
break;
case VALUE_TYPE.color :
draw_tooltip_color(content);
break;
case VALUE_TYPE.gradient :
draw_tooltip_gradient(content);
break;
case VALUE_TYPE.d3object :
draw_tooltip_text("[" + __txt("3D Object") + "]");
break;
case VALUE_TYPE.object :
draw_tooltip_text("[" + __txt("Object") + "]");
break;
case VALUE_TYPE.surface :
draw_tooltip_surface(content);
break;
case VALUE_TYPE.rigid :
draw_tooltip_text("[" + __txt("Rigidbody Object") + " (id: " + string(content[$ "object"]) + ")]");
break;
case VALUE_TYPE.particle :
var txt = "[" +
__txt("Particle Object") +
" (size: " + string(array_length(content)) + ") " +
"]";
draw_tooltip_text(txt);
break;
case VALUE_TYPE.pathnode :
draw_tooltip_text("[" + __txt("Path Object") + "]");
break;
case VALUE_TYPE.fdomain :
draw_tooltip_text("[" + __txt("Fluid Domain") + " (id: " + string(content) + ")]");
break;
case VALUE_TYPE.strands :
var txt = __txt("Strands Object");
if(is_struct(content))
txt += " (strands: " + string(array_length(content.hairs)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.mesh :
var txt = __txt("Mesh Object");
if(is_struct(content))
txt += " (triangles: " + string(array_length(content.triangles)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.d3vertex :
var txt = __txt("3D Vertex");
txt += " (groups: " + string(array_length(content)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.atlas :
draw_tooltip_atlas(content);
break;
case VALUE_TYPE.buffer :
draw_tooltip_buffer(content);
break;
}
} else
draw_tooltip_text(TOOLTIP);
}
switch(type) {
case VALUE_TYPE.float :
case VALUE_TYPE.integer :
case VALUE_TYPE.text :
case VALUE_TYPE.struct :
case VALUE_TYPE.path :
draw_tooltip_text(string_real(content));
break;
case VALUE_TYPE.boolean :
draw_tooltip_text(printBool(content));
break;
case VALUE_TYPE.curve :
draw_tooltip_text("[" + __txt("Curve Object") + "]");
break;
case VALUE_TYPE.color :
draw_tooltip_color(content);
break;
case VALUE_TYPE.gradient :
draw_tooltip_gradient(content);
break;
case VALUE_TYPE.d3object :
draw_tooltip_text("[" + __txt("3D Object") + "]");
break;
case VALUE_TYPE.object :
draw_tooltip_text("[" + __txt("Object") + "]");
break;
case VALUE_TYPE.surface :
draw_tooltip_surface(content);
break;
case VALUE_TYPE.rigid :
draw_tooltip_text("[" + __txt("Rigidbody Object") + " (id: " + string(content[$ "object"]) + ")]");
break;
case VALUE_TYPE.particle :
var txt = "[" +
__txt("Particle Object") +
" (size: " + string(array_length(content)) + ") " +
"]";
draw_tooltip_text(txt);
break;
case VALUE_TYPE.pathnode :
draw_tooltip_text("[" + __txt("Path Object") + "]");
break;
case VALUE_TYPE.fdomain :
draw_tooltip_text("[" + __txt("Fluid Domain") + " (id: " + string(content) + ")]");
break;
case VALUE_TYPE.strands :
var txt = __txt("Strands Object");
if(is_struct(content))
txt += " (strands: " + string(array_length(content.hairs)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.mesh :
var txt = __txt("Mesh Object");
if(is_struct(content))
txt += " (triangles: " + string(array_length(content.triangles)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.d3vertex :
var txt = __txt("3D Vertex");
txt += " (groups: " + string(array_length(content)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.atlas :
draw_tooltip_atlas(content);
break;
case VALUE_TYPE.buffer :
draw_tooltip_buffer(content);
break;
}
} else if(TOOLTIP != "")
draw_tooltip_text(TOOLTIP);
TOOLTIP = "";
#endregion

View file

@ -25,6 +25,11 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
current_data = [ 0, 0, 0, 0 ];
adjust_shape = true;
mode = AREA_MODE.area;
tooltip = new tooltipSelector("Area type", [
__txtx("widget_area_center_Span", "Center + Span"),
__txtx("widget_area_padding", "Padding"),
__txtx("widget_area_two_points", "Two points"),
]);
onModifySingle[0] = function(val) { #region
var v = toNumber(val);
@ -166,18 +171,13 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
}
} #endregion
var txt = "";
switch(mode) {
case AREA_MODE.area : txt = __txtx("widget_area_center_Span", "Center + Span"); break;
case AREA_MODE.padding : txt = __txtx("widget_area_padding", "Padding"); break;
case AREA_MODE.two_point : txt = __txtx("widget_area_two_points", "Two points"); break;
}
tooltip.index = mode;
var _bx = _x + ui(76 - 24);
var _by = _y + ui(28 - 12);
var _bs = ui(24);
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, txt, THEME.inspector_area_type, mode, c_white) == 2) { #region
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, tooltip, THEME.inspector_area_type, mode, c_white) == 2) { #region
switch(mode) {
case AREA_MODE.area : //area to padding
var cx = array_safe_get(_data, 0);

View file

@ -97,11 +97,16 @@ function __3dScene(camera) constructor {
static submitSel = function(object, shader = noone) { _submit(function(object, shader) { object.submitSel (self, shader); }, object, shader) }
static submitShader = function(object, shader = noone) { _submit(function(object, shader) { object.submitShader (self, shader); }, object, shader) }
static deferPass = function(object, w, h) { #region
var geometry_data = geometryPass(object, w, h);
var ssao = ssaoPass(geometry_data);
static deferPass = function(object, w, h, deferData = noone) { #region
if(deferData == noone) deferData = {
geometry_data: [ noone, noone, noone ],
ssao : noone,
};
return { geometry_data, ssao };
geometryPass(deferData, object, w, h);
ssaoPass(deferData);
return deferData;
} #endregion
static renderBackground = function(w, h) { #region
@ -127,15 +132,14 @@ function __3dScene(camera) constructor {
return _bgSurf;
} #endregion
static geometryPass = function(object, w = 512, h = 512) { #region
var geometry_data = [ noone, noone, noone ];
geometry_data[0] = surface_verify(geometry_data[0], w, h, surface_rgba32float);
geometry_data[1] = surface_verify(geometry_data[1], w, h, surface_rgba32float);
geometry_data[2] = surface_verify(geometry_data[2], w, h, surface_rgba32float);
static geometryPass = function(deferData, object, w = 512, h = 512) { #region
deferData.geometry_data[0] = surface_verify(deferData.geometry_data[0], w, h, surface_rgba32float);
deferData.geometry_data[1] = surface_verify(deferData.geometry_data[1], w, h, surface_rgba32float);
deferData.geometry_data[2] = surface_verify(deferData.geometry_data[2], w, h, surface_rgba32float);
surface_set_target_ext(0, geometry_data[0]);
surface_set_target_ext(1, geometry_data[1]);
surface_set_target_ext(2, geometry_data[2]);
surface_set_target_ext(0, deferData.geometry_data[0]);
surface_set_target_ext(1, deferData.geometry_data[1]);
surface_set_target_ext(2, deferData.geometry_data[2]);
gpu_set_zwriteenable(true);
gpu_set_ztestenable(true);
@ -156,50 +160,46 @@ function __3dScene(camera) constructor {
surface_reset_target();
if(defer_normal_radius) {
var _normal_blurred = surface_create_size(geometry_data[2], surface_rgba32float);
var _normal_blurred = surface_create_size(deferData.geometry_data[2], surface_rgba32float);
surface_set_shader(_normal_blurred, sh_d3d_normal_blur);
shader_set_f("radius", defer_normal_radius);
shader_set_dim("dimension", geometry_data[2]);
draw_surface_safe(geometry_data[2]);
shader_set_dim("dimension", deferData.geometry_data[2]);
draw_surface_safe(deferData.geometry_data[2]);
surface_reset_shader();
surface_free(geometry_data[2]);
geometry_data[2] = _normal_blurred;
surface_free(deferData.geometry_data[2]);
deferData.geometry_data[2] = _normal_blurred;
}
return geometry_data;
} #endregion
static ssaoPass = function(geometry_data) { #region
static ssaoPass = function(deferData) { #region
if(!ssao_enabled) return;
var _sw = surface_get_width(geometry_data[0]);
var _sh = surface_get_height(geometry_data[0]);
var _sw = surface_get_width(deferData.geometry_data[0]);
var _sh = surface_get_height(deferData.geometry_data[0]);
var _ssao_surf = surface_create(_sw, _sh);
surface_set_shader(_ssao_surf, sh_d3d_ssao);
shader_set_surface("vPosition", geometry_data[0]);
shader_set_surface("vNormal", geometry_data[2]);
shader_set_surface("vPosition", deferData.geometry_data[0]);
shader_set_surface("vNormal", deferData.geometry_data[2]);
shader_set_f("radius", ssao_radius);
shader_set_f("bias", ssao_bias);
shader_set_f("strength", ssao_strength * 2);
shader_set_f("projMatrix", camera.getCombinedMatrix());
shader_set_f("cameraPosition", camera.position.toArray());
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, _sw, _sh);
surface_reset_shader();
var _ssao_blur = surface_create(_sw, _sh);
surface_set_shader(_ssao_blur, sh_d3d_ssao_blur);
deferData.ssao = surface_verify(deferData.ssao, _sw, _sh);
surface_set_shader(deferData.ssao, sh_d3d_ssao_blur);
shader_set_f("dimension", _sw, _sh);
shader_set_surface("vNormal", geometry_data[2]);
shader_set_surface("vNormal", deferData.geometry_data[2]);
draw_surface_safe(_ssao_surf);
surface_reset_shader();
surface_free(_ssao_surf);
return _ssao_blur;
} #endregion
static apply = function(deferData = noone) { #region

View file

@ -5,7 +5,7 @@
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "draw",
"path": "folders/functions/draw.yy",
"name": "tooltip",
"path": "folders/functions/tooltip.yy",
},
}

View file

@ -13,6 +13,8 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
scene = new __3dScene(camera);
scene.name = "Camera";
deferData = noone;
global.SKY_SPHERE = new __3dUVSphere(0.5, 16, 8, true);
inputs[| in_d3d + 0] = nodeValue("FOV", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 60 )
@ -264,7 +266,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
scene.draw_background = _dbg;
var _bgSurf = _dbg? scene.renderBackground(_dim[0], _dim[1]) : noone;
var _defer = scene.deferPass(_scne, _dim[0], _dim[1]);
deferData = scene.deferPass(_scne, _dim[0], _dim[1], deferData);
var _render = outputs[| 0].getValue();
var _normal = outputs[| 1].getValue();
@ -288,7 +290,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
scene.reset();
scene.submitShader(_scne);
scene.apply(_defer);
scene.apply(deferData);
scene.submit(_scne);
surface_reset_target();
@ -307,7 +309,7 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
draw_surface(_render, 0, 0);
BLEND_MULTIPLY
draw_surface_safe(_defer.ssao);
draw_surface_safe(deferData.ssao);
BLEND_NORMAL
surface_reset_target();
surface_free(_render);

View file

@ -372,7 +372,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
ds_list_add(d3d, "Compose");
addNodeObject(d3d, "3D Scene", s_node_3d_scene, "Node_3D_Scene", [1, Node_3D_Scene]);
addNodeObject(d3d, "3D Repeat", s_node_3d_scene, "Node_3D_Repeat", [1, Node_3D_Repeat]);
addNodeObject(d3d, "3D Repeat", s_node_3d_array, "Node_3D_Repeat", [1, Node_3D_Repeat]);
ds_list_add(d3d, "Mesh");
addNodeObject(d3d, "3D Object", s_node_3d_obj, "Node_3D_Mesh_Obj", [0, Node_create_3D_Obj],, "Load .obj file from your computer as a 3D object.");

View file

@ -670,7 +670,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
extract_node = "Node_Number";
break; #endregion
case VALUE_DISPLAY.d3quarternion :
case VALUE_DISPLAY.vector : #region
var val = animator.getValue();
if(array_length(val) <= 4) {
@ -856,6 +855,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
key_inter = CURVE_TYPE.cut;
extract_node = "";
break; #endregion
case VALUE_DISPLAY.d3quarternion : #region
editWidget = new quarternionBox(function(index, val) {
return setValueDirect(val, index);
});
extra_data.angle_display = QUARTERNION_DISPLAY.quarterion;
break; #endregion
}
break;
case VALUE_TYPE.boolean : #region
@ -1080,7 +1087,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#endregion
if(display_type == VALUE_DISPLAY.area) { #region
var dispType = struct_try_get(nodeFrom.extra_data, "area_type", AREA_MODE.area);
var dispType = struct_try_get(nodeFrom.extra_data, "area_type");
var surfGet = nodeFrom.display_data;
if(!applyUnit || surfGet == -1) {
//print($" {value}");
@ -1111,6 +1118,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
} #endregion
if(display_type == VALUE_DISPLAY.d3quarternion) { #region
var dispType = struct_try_get(nodeFrom.extra_data, "angle_display");
switch(dispType) {
case QUARTERNION_DISPLAY.quarterion : return value;
case QUARTERNION_DISPLAY.euler :
var euler = new BBMOD_Quaternion().FromEuler(value[0], value[1], value[2]).ToArray();
return euler;
}
} #endregion
if(type == VALUE_TYPE.text) { #region
switch(display_type) {
case VALUE_DISPLAY.text_array : return value;

View file

@ -394,7 +394,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
}
} #endregion
function draw() { #region
static draw = function() { #region
if(hasContent()) {
drawPanel();
return;
@ -898,7 +898,7 @@ function PanelContent() constructor {
function stepBegin() {}
function draw(panel) { #region
static draw = function(panel) { #region
self.panel = panel;
if(o_main.panel_dragging == noone) {
pFOCUS = FOCUS == panel && panel.mouse_active;

View file

@ -87,7 +87,8 @@ function Panel_Preview() : PanelContent() constructor {
node.preview_channel = array_safe_get(sbChannelIndex, index);
}); #endregion
sbChannelIndex = [];
sbChannelIndex = [];
sbChannel.font = f_p1;
sbChannel.align = fa_left;
#endregion
@ -103,6 +104,8 @@ function Panel_Preview() : PanelContent() constructor {
d3_surface_bg = noone;
d3_preview_channel = 0;
d3_deferData = noone;
global.SKY_SPHERE = new __3dUVSphere(0.5, 16, 8, true);
#region camera
@ -521,9 +524,9 @@ function Panel_Preview() : PanelContent() constructor {
sbChannelIndex = [];
var currName = _node.outputs[| _node.preview_channel].name;
draw_set_text(f_p0, fa_center, fa_center);
var ww = clamp(w - ui(240), string_width(currName) + ui(48), ui(200));
var hh = toolbar_height - ui(12);
draw_set_text(sbChannel.font, fa_center, fa_center);
var ww = 0;
var hh = TEXTBOX_HEIGHT - ui(2);
for( var i = 0; i < ds_list_size(_node.outputs); i++ ) {
if(_node.outputs[| i].type != VALUE_TYPE.surface) continue;
@ -532,9 +535,9 @@ function Panel_Preview() : PanelContent() constructor {
array_push(sbChannelIndex, i);
ww = max(ww, string_width(_node.outputs[| i].name) + ui(40));
}
sbChannel.data_list = chName;
sbChannel.setFocusHover(pFOCUS, pHOVER);
sbChannel.draw(_x - ww, _y - hh / 2, ww, hh, currName, [mx, my], x, y);
right_menu_y += ui(40);
} #endregion
@ -837,7 +840,7 @@ function Panel_Preview() : PanelContent() constructor {
#region defer
var _prev_obj = _prev_node.getPreviewObject();
var _defer = d3_scene_preview.deferPass(_prev_obj, w, h);
d3_deferData = d3_scene_preview.deferPass(_prev_obj, w, h, d3_deferData);
#endregion
#region grid
@ -887,7 +890,7 @@ function Panel_Preview() : PanelContent() constructor {
_prev.submitShader(d3_scene_preview);
}
d3_scene_preview.apply(_defer);
d3_scene_preview.apply(d3_deferData);
for( var i = 0, n = array_length(_prev_obj); i < n; i++ ) {
var _prev = _prev_obj[i];
@ -907,7 +910,7 @@ function Panel_Preview() : PanelContent() constructor {
draw_surface_safe(d3_surface);
BLEND_MULTIPLY
draw_surface_safe(_defer.ssao);
draw_surface_safe(d3_deferData.ssao);
BLEND_NORMAL
//draw_clear(c_white);

View file

@ -0,0 +1,106 @@
enum QUARTERNION_DISPLAY {
quarterion,
euler,
}
function quarternionBox(_onModify) : widget() constructor {
onModify = _onModify;
current_value = [];
onModifyIndex = function(index, val) {
var v = toNumber(val);
if(is_callable(onModify))
return onModify(index, v);
return noone;
}
size = 4;
axis = [ "x", "y", "z", "w" ];
tooltip = new tooltipSelector("Angle type", ["Quarternion", "Euler"]);
disp_w = noone;
clickable = true;
onModifySingle[0] = function(val) { return onModifyIndex(0, val); }
onModifySingle[1] = function(val) { return onModifyIndex(1, val); }
onModifySingle[2] = function(val) { return onModifyIndex(2, val); }
onModifySingle[3] = function(val) { return onModifyIndex(3, val); }
for(var i = 0; i < 4; i++) {
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);
tb[i].slidable = true;
}
static setSlideSpeed = function(speed) {
for(var i = 0; i < size; i++)
tb[i].slide_speed = speed;
}
static setInteract = function(interactable) {
self.interactable = interactable;
for( var i = 0; i < size; i++ )
tb[i].interactable = interactable;
}
static register = function(parent = noone) {
for( var i = 0; i < size; i++ )
tb[i].register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.extra_data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _extra_data, _m) {
x = _x;
y = _y;
w = _w;
h = _h;
if(!is_array(_data)) return 0;
if(array_empty(_data)) return 0;
if(is_array(_data[0])) return 0;
current_value = _data;
var bs = ui(32);
var bx = _x + _w - bs;
var by = _y + _h / 2 - bs / 2;
tooltip.index = _extra_data.angle_display;
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, active, hover, tooltip, THEME.unit_angle, _extra_data.angle_display, c_white) == 2) {
clickable = false;
_extra_data.angle_display = (_extra_data.angle_display + 1) % 2;
}
_w -= ui(40);
size = _extra_data.angle_display? 3 : 4;
var ww = _w / size;
var bx = _x;
disp_w = disp_w == noone? ww : lerp_float(disp_w, ww, 3);
for(var i = 0; i < size; i++) {
tb[i].setFocusHover(clickable && active, hover);
tb[i].draw(bx + ui(24), _y, disp_w - ui(24), _h, _data[i], _m);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_inner);
draw_text(bx + ui(8), _y + _h / 2, axis[i]);
bx += disp_w;
}
clickable = true;
resetFocus();
return _h;
}
static apply = function() {
for( var i = 0; i < size; i++ ) {
tb[i].apply();
current_value[i] = toNumber(tb[i]._input_text);
}
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "quarternionBox",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "widgets",
"path": "folders/widgets.yy",
},
}

View file

@ -0,0 +1,46 @@
function tooltipSelector(title, data, index = 0) constructor {
self.title = title;
self.data = data;
self.index = index;
arrow_pos = noone;
arrow_pos_to = 0;
static drawTooltip = function() {
draw_set_font(f_p0);
var th = line_get_height();
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
var lh = line_get_height();
var _h = (th + ui(6)) + (lh + ui(4)) * array_length(data);
var _w = string_width(title);
for( var i = 0, n = array_length(data); i < n; i++ )
_w = max(_w, ui(8 + 16) + string_width(data[i]));
var mx = min(mouse_mx + ui(16), WIN_W - (_w + ui(16) + ui(4)));
var my = min(mouse_my + ui(16), WIN_H - (_h + ui(16) + ui(4)));
draw_sprite_stretched(THEME.textbox, 3, mx, my, _w + ui(16), _h + ui(16));
draw_sprite_stretched(THEME.textbox, 0, mx, my, _w + ui(16), _h + ui(16));
var yy = my + ui(8);
draw_set_font(f_p0);
draw_text(mx + ui(8), yy, title);
yy += th + ui(6);
draw_set_font(f_p1);
for( var i = 0, n = array_length(data); i < n; i++ ) {
if(i == index) arrow_pos_to = (yy + lh / 2) - my;
draw_set_color(i == index? COLORS._main_text_accent : COLORS._main_text_sub);
draw_text(mx + ui(8 + 24), yy, data[i]);
yy += lh + ui(4);
}
arrow_pos = arrow_pos == noone? arrow_pos_to : lerp_float(arrow_pos, arrow_pos_to, 3);
draw_sprite_ui(THEME.arrow, 0, mx + ui(8 + 12), my + arrow_pos, ,,, COLORS._main_text_accent);
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "tooltip_selector_object",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "tooltip",
"path": "folders/functions/tooltip.yy",
},
}

View file

@ -77,10 +77,6 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x;
y = _y;