mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-23 10:25:42 +01:00
armature preview
This commit is contained in:
parent
3c251b2cd8
commit
a46bc81de0
11 changed files with 250 additions and 81 deletions
|
@ -115,31 +115,24 @@ function __Bone(_parent = noone, _distance = 0, _direction = 0, _angle = 0, _len
|
|||
}
|
||||
|
||||
static draw = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, _hover = noone, _select = noone, _blend = c_white, _alpha = 1) {
|
||||
return _drawBone(attributes, edit, _x, _y, _s, _mx, _my, _hover, _select, _blend, _alpha);
|
||||
}
|
||||
|
||||
static _drawBone = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, _hover = noone, _select = noone, _blend = c_white, _alpha = 1) {
|
||||
var hover = noone;
|
||||
setControl(_x, _y, _s);
|
||||
|
||||
control_x0 = _x + bone_head_pose.x * _s;
|
||||
control_y0 = _y + bone_head_pose.y * _s;
|
||||
control_x1 = _x + bone_tail_pose.x * _s;
|
||||
control_y1 = _y + bone_tail_pose.y * _s;
|
||||
var hover = noone, h;
|
||||
|
||||
if(parent != noone) {
|
||||
var h = __drawBoneUI(attributes, edit, _x, _y, _s, _mx, _my, _hover, _select, _blend, _alpha);
|
||||
h = drawBone(attributes, edit, _x, _y, _s, _mx, _my, _hover, _select, _blend, _alpha);
|
||||
if(h != noone) hover = h;
|
||||
}
|
||||
|
||||
for( var i = 0, n = array_length(childs); i < n; i++ ) {
|
||||
var h = childs[i]._drawBone(attributes, edit, _x, _y, _s, _mx, _my, _hover, _select, _blend, _alpha);
|
||||
if(hover == noone && h != noone) hover = h;
|
||||
h = childs[i].draw(attributes, edit, _x, _y, _s, _mx, _my, _hover, _select, _blend, _alpha);
|
||||
if(h != noone && (hover == noone || IKlength)) hover = h;
|
||||
}
|
||||
|
||||
return hover;
|
||||
}
|
||||
|
||||
static __drawBoneUI = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, _hover = noone, _select = noone, _blend = c_white, _alpha = 1) {
|
||||
static drawBone = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, _hover = noone, _select = noone, _blend = c_white, _alpha = 1) {
|
||||
var hover = noone;
|
||||
|
||||
var p0x = _x + bone_head_pose.x * _s;
|
||||
|
@ -274,6 +267,54 @@ function __Bone(_parent = noone, _distance = 0, _direction = 0, _angle = 0, _len
|
|||
return hover;
|
||||
}
|
||||
|
||||
static drawThumbnail = function(_s, _bbox, _bone_bbox = undefined) {
|
||||
_bone_bbox ??= bbox();
|
||||
|
||||
if(!is_main && is_array(_bone_bbox)) {
|
||||
var boxs = min(_bbox.w / _bone_bbox[4], _bbox.h / _bone_bbox[5]);
|
||||
|
||||
_bbox.w = boxs * _bone_bbox[4];
|
||||
_bbox.h = boxs * _bone_bbox[5];
|
||||
|
||||
_bbox.x0 = _bbox.xc - _bbox.w / 2;
|
||||
_bbox.x1 = _bbox.xc + _bbox.w / 2;
|
||||
|
||||
_bbox.y0 = _bbox.yc - _bbox.h / 2;
|
||||
_bbox.y1 = _bbox.yc + _bbox.h / 2;
|
||||
|
||||
var p0x = _bbox.x0 + _bbox.w * (bone_head_pose.x - _bone_bbox[0]) / _bone_bbox[4];
|
||||
var p0y = _bbox.y0 + _bbox.h * (bone_head_pose.y - _bone_bbox[1]) / _bone_bbox[5];
|
||||
var p1x = _bbox.x0 + _bbox.w * (bone_tail_pose.x - _bone_bbox[0]) / _bone_bbox[4];
|
||||
var p1y = _bbox.y0 + _bbox.h * (bone_tail_pose.y - _bone_bbox[1]) / _bone_bbox[5];
|
||||
|
||||
draw_set_circle_precision(8);
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_line_width(p0x, p0y, p1x, p1y, 1.5 * _s);
|
||||
|
||||
draw_set_color(COLORS._main_icon_dark);
|
||||
draw_circle(p0x, p0y, 4 * _s, false);
|
||||
draw_circle(p1x, p1y, 4 * _s, false);
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_circle(p0x, p0y, 2 * _s, false);
|
||||
draw_circle(p1x, p1y, 2 * _s, false);
|
||||
}
|
||||
|
||||
for( var i = 0, n = array_length(childs); i < n; i++ )
|
||||
childs[i].drawThumbnail(_s, _bbox, _bone_bbox);
|
||||
}
|
||||
|
||||
static setControl = function(_x = 0, _y = 0, _s = 1) {
|
||||
control_x0 = _x + bone_head_pose.x * _s;
|
||||
control_y0 = _y + bone_head_pose.y * _s;
|
||||
control_x1 = _x + bone_tail_pose.x * _s;
|
||||
control_y1 = _y + bone_tail_pose.y * _s;
|
||||
|
||||
for( var i = 0, n = array_length(childs); i < n; i++ )
|
||||
childs[i].setControl(_x, _y, _s);
|
||||
}
|
||||
|
||||
static drawControl = function(attributes) {
|
||||
if(parent != noone && IKlength == 0) {
|
||||
if(!parent_anchor)
|
||||
|
@ -502,7 +543,7 @@ function __Bone(_parent = noone, _distance = 0, _direction = 0, _angle = 0, _len
|
|||
var x1 = max(p0.x, p1.x);
|
||||
var y1 = max(p0.y, p1.y);
|
||||
|
||||
return [ x0, y0, x1, y1 ];
|
||||
return [ x0, y0, x1, y1, 0, 0 ];
|
||||
}
|
||||
|
||||
static bbox = function() {
|
||||
|
@ -520,6 +561,11 @@ function __Bone(_parent = noone, _distance = 0, _direction = 0, _angle = 0, _len
|
|||
} else _bbox = _bbox_ch;
|
||||
}
|
||||
|
||||
if(is_array(_bbox)) {
|
||||
_bbox[4] = _bbox[2] - _bbox[0];
|
||||
_bbox[5] = _bbox[3] - _bbox[1];
|
||||
}
|
||||
|
||||
return _bbox;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,13 +38,15 @@
|
|||
THEME = new Theme();
|
||||
COLOR_KEYS = [];
|
||||
|
||||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
||||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION, NIGHTLY;
|
||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||
|
||||
|
||||
NIGHTLY = true;
|
||||
|
||||
LATEST_VERSION = 1_18_00_0;
|
||||
VERSION = 1_18_04_0;
|
||||
SAVE_VERSION = 1_18_04_0;
|
||||
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.006";
|
||||
VERSION_STRING = MAC? "1.18.003m" : "1.18.5.007";
|
||||
BUILD_NUMBER = 1_18_04_1;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Armature Create";
|
||||
setDimension(96, 72);
|
||||
setDimension(96, 96);
|
||||
draw_padding = 8;
|
||||
|
||||
bone_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
var _b = bones;
|
||||
|
@ -183,6 +184,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
bone_point_maps = [];
|
||||
bone_point_mape = [];
|
||||
|
||||
bone_bbox = undefined;
|
||||
bone_transform_bbox = -1;
|
||||
bone_transform_type = -1;
|
||||
|
||||
|
@ -752,6 +754,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
static update = function(frame = CURRENT_FRAME) {
|
||||
bones.resetPose()
|
||||
.setPosition();
|
||||
bone_bbox = bones.bbox();
|
||||
|
||||
outputs[0].setValue(bones);
|
||||
}
|
||||
|
@ -804,7 +807,13 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_armature_create, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
|
||||
var _ss = _s * .5;
|
||||
gpu_set_tex_filter(1);
|
||||
draw_sprite_ext(s_node_armature_create, 0, bbox.x0 + 24 * _ss, bbox.y1 - 24 * _ss, _ss, _ss, 0, c_white, 0.5);
|
||||
gpu_set_tex_filter(0);
|
||||
|
||||
bones.drawThumbnail(_s, bbox, bone_bbox);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ function RiggedMeshedSurface() : dynaSurf() constructor {
|
|||
|
||||
function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Armature Mesh Rig";
|
||||
setDimension(96, 72);
|
||||
setDimension(96, 96);
|
||||
draw_padding = 8;
|
||||
|
||||
newInput(0, nodeValue_Armature("Armature", self, noone))
|
||||
.setVisible(true, true);
|
||||
|
@ -30,6 +31,7 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
bone_posed = noone;
|
||||
rigdata = noone;
|
||||
anchor_selecting = noone;
|
||||
bone_bbox = undefined;
|
||||
|
||||
attributes.bonePoseData = {};
|
||||
attributes.rigBones = noone;
|
||||
|
@ -287,7 +289,7 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
for( var i = 0, n = array_length(_boneArr); i < n; i++ ) {
|
||||
var _b = _boneArr[i];
|
||||
var _l = attributes.rigBones == noone || array_exists(attributes.rigBones, _b.ID);
|
||||
_b.__drawBoneUI(attributes, false, _x, _y, _s, _mx, _my, anchor_selecting, noone, c_white, 0.25 + _l * 0.75);
|
||||
_b.drawBone(attributes, false, _x, _y, _s, _mx, _my, anchor_selecting, noone, c_white, 0.25 + _l * 0.75);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,6 +399,7 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
}
|
||||
|
||||
bone_posed.setPose(false);
|
||||
bone_bbox = bone_posed.bbox();
|
||||
|
||||
if(rigdata == noone) AutoWeightPaint(false);
|
||||
|
||||
|
@ -418,6 +421,19 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
|
|||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_armature_mesh_rig, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
|
||||
if(bone_posed != noone) {
|
||||
var _ss = _s * .5;
|
||||
gpu_set_tex_filter(1);
|
||||
draw_sprite_ext(s_node_armature_mesh_rig, 0, bbox.x0 + 24 * _ss, bbox.y1 - 24 * _ss, _ss, _ss, 0, c_white, 0.5);
|
||||
gpu_set_tex_filter(0);
|
||||
|
||||
bone_posed.drawThumbnail(_s, bbox, bone_bbox);
|
||||
|
||||
} else {
|
||||
gpu_set_tex_filter(1);
|
||||
draw_sprite_fit(s_node_armature_mesh_rig, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
gpu_set_tex_filter(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Armature Pose";
|
||||
setDimension(96, 72);
|
||||
setDimension(96, 96);
|
||||
draw_padding = 8;
|
||||
|
||||
newInput(0, nodeValue_Armature("Armature", self, noone))
|
||||
.setVisible(true, true);
|
||||
|
@ -9,9 +10,11 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
|
||||
newOutput(0, nodeValue_Output("Armature", self, VALUE_TYPE.armature, noone));
|
||||
|
||||
boneHash = "";
|
||||
bonePose = noone;
|
||||
boneMap = {};
|
||||
boneHash = "";
|
||||
bonePose = noone;
|
||||
bone_bbox = undefined;
|
||||
boneArray = [];
|
||||
boneMap = {};
|
||||
|
||||
attributes.display_name = true;
|
||||
attributes.display_bone = 0;
|
||||
|
@ -42,16 +45,12 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
if(_b == noone) return;
|
||||
|
||||
bonePose = _b.clone().connect();
|
||||
var _bArr = _b.toArray();
|
||||
boneArray = bonePose.toArray();
|
||||
var _inputs = [ inputs[0] ];
|
||||
var _input_display_list = array_clone(input_display_list_raw, 1);
|
||||
|
||||
var _input_display_list = [
|
||||
input_display_list[0],
|
||||
input_display_list[1]
|
||||
];
|
||||
|
||||
for( var i = 0, n = array_length(_bArr); i < n; i++ ) {
|
||||
var bone = _bArr[i];
|
||||
for( var i = 0, n = array_length(boneArray); i < n; i++ ) {
|
||||
var bone = boneArray[i];
|
||||
var _idx = array_length(_inputs);
|
||||
var _inp;
|
||||
|
||||
|
@ -85,12 +84,43 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var _b = inputs[0].getValue();
|
||||
|
||||
if(_b == noone) return;
|
||||
if(bonePose == noone) return;
|
||||
if(_b == noone || bonePose == noone) return;
|
||||
|
||||
anchor_selecting = bonePose.draw(attributes, active * 0b111, _x, _y, _s, _mx, _my, anchor_selecting, posing_bone);
|
||||
var _hov = noone, hh, cc, aa;
|
||||
var _bhov = anchor_selecting;
|
||||
|
||||
for( var i = 0, n = array_length(boneArray); i < n; i++ ) {
|
||||
var _bne = boneArray[i];
|
||||
var _sel = false;
|
||||
|
||||
cc = c_white;
|
||||
|
||||
if(struct_has(boneMap, _bne.ID)) {
|
||||
var _inp = boneMap[$ _bne.ID];
|
||||
_sel = _inp.value_from == noone || is(_inp.value_from.node, Node_Vector4);
|
||||
|
||||
if(_bhov == noone && PANEL_INSPECTOR.prop_hover == _inp)
|
||||
_bhov = [ _bne, 2 ];
|
||||
}
|
||||
|
||||
hh = _bne.drawBone(attributes, _sel * active * 0b111, _x, _y, _s, _mx, _my, _bhov, posing_bone, cc, .5 + .5 * _sel);
|
||||
|
||||
if(hh != noone && (_hov == noone || _bne.IKlength)) _hov = hh;
|
||||
}
|
||||
|
||||
anchor_selecting = _hov;
|
||||
bonePose.setControl(_x, _y, _s);
|
||||
bonePose.drawControl(attributes);
|
||||
|
||||
if(anchor_selecting != noone) {
|
||||
var _bne = anchor_selecting[0];
|
||||
|
||||
if(struct_has(boneMap, _bne.ID)) {
|
||||
var _inp = boneMap[$ _bne.ID];
|
||||
_inp.editWidget.temp_hovering = true;
|
||||
}
|
||||
}
|
||||
|
||||
var mx = (_mx - _x) / _s;
|
||||
var my = (_my - _y) / _s;
|
||||
|
||||
|
@ -301,6 +331,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
}
|
||||
|
||||
bonePose.setPose();
|
||||
bone_bbox = bonePose.bbox();
|
||||
|
||||
outputs[0].setValue(bonePose);
|
||||
}
|
||||
|
@ -355,7 +386,19 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_armature_pose, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
if(bonePose != noone) {
|
||||
var _ss = _s * .5;
|
||||
gpu_set_tex_filter(1);
|
||||
draw_sprite_ext(s_node_armature_pose, 0, bbox.x0 + 24 * _ss, bbox.y1 - 24 * _ss, _ss, _ss, 0, c_white, 0.5);
|
||||
gpu_set_tex_filter(0);
|
||||
|
||||
bonePose.drawThumbnail(_s, bbox, bone_bbox);
|
||||
|
||||
} else {
|
||||
gpu_set_tex_filter(1);
|
||||
draw_sprite_fit(s_node_armature_pose, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
gpu_set_tex_filter(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1411,12 +1411,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var y1 = yy + h * _s;
|
||||
|
||||
if(pad_label) y0 += name_height * _s;
|
||||
if(SHOW_PARAM) y1 = yy + con_h * _s;
|
||||
if(SHOW_PARAM) y1 = yy + con_h * _s;
|
||||
|
||||
x0 += max(draw_padding, draw_pad_w);
|
||||
x1 -= max(draw_padding, draw_pad_w);
|
||||
y0 += max(draw_padding, draw_pad_h);
|
||||
y1 -= max(draw_padding, draw_pad_h);
|
||||
x0 += max(draw_padding, draw_pad_w) * _s;
|
||||
x1 -= max(draw_padding, draw_pad_w) * _s;
|
||||
y0 += max(draw_padding, draw_pad_h) * _s;
|
||||
y1 -= max(draw_padding, draw_pad_h) * _s;
|
||||
|
||||
var _w = x1 - x0;
|
||||
var _h = y1 - y0;
|
||||
|
|
|
@ -3376,7 +3376,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
_jun.visible_manual = -1;
|
||||
}
|
||||
|
||||
_node.setHeight();
|
||||
_node.refreshNodeDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -985,6 +985,11 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
color_picker_index++;
|
||||
}
|
||||
|
||||
if(jun.editWidget.temp_hovering) {
|
||||
draw_sprite_stretched_ext(THEME.prop_selecting, 0, ui(4), _selY, contentPane.surface_w - ui(8), _selH, COLORS._main_accent, 1);
|
||||
jun.editWidget.temp_hovering = false;
|
||||
}
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], ui(4), _selY, contentPane.surface_w - ui(4), _selY + _selH)) { // mouse in widget
|
||||
_HOVERING_ELEMENT = jun;
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
previewNode = "";
|
||||
inspectingNode = "";
|
||||
|
||||
is_nightly = false;
|
||||
|
||||
previewGrid = {
|
||||
show : false,
|
||||
snap : false,
|
||||
|
@ -225,7 +227,8 @@
|
|||
|
||||
static serialize = function() {
|
||||
var _map = {};
|
||||
_map.version = SAVE_VERSION;
|
||||
_map.version = SAVE_VERSION;
|
||||
_map.is_nightly = NIGHTLY;
|
||||
|
||||
var _anim_map = {};
|
||||
_anim_map.frames_total = animator.frames_total;
|
||||
|
@ -293,6 +296,7 @@
|
|||
|
||||
if(struct_has(_map, "graph_display_parameter")) struct_override(graph_display_parameter, _map.graph_display_parameter);
|
||||
|
||||
is_nightly = struct_try_get(_map, "is_nightly", is_nightly);
|
||||
load_layout = struct_try_get(_map, "load_layout", load_layout);
|
||||
|
||||
setPalette();
|
||||
|
|
|
@ -25,6 +25,8 @@ function transformBox(_onModify) : widget() constructor {
|
|||
tb[i].label = labels[i];
|
||||
}
|
||||
|
||||
rot.tb_value.label = "rot";
|
||||
|
||||
static setInteract = function(interactable = noone) {
|
||||
self.interactable = interactable;
|
||||
|
||||
|
@ -74,42 +76,80 @@ function transformBox(_onModify) : widget() constructor {
|
|||
tb[i].hide = true;
|
||||
}
|
||||
|
||||
var _lab = _w > ui(160);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
|
||||
var lbw = _lab? string_width(__txt("Position")) + ui(8) : 0;
|
||||
var tbw = (_w - lbw) / 2;
|
||||
var tbh = _h;
|
||||
var tbx = _x + lbw;
|
||||
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Position"));
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, tbx, _y, _w - lbw, tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, tbx, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tb[TRANSFORM.pos_x].draw(tbx, _y, tbw, tbh, _data[TRANSFORM.pos_x], _m);
|
||||
tb[TRANSFORM.pos_y].draw(tbx + tbw, _y, tbw, tbh, _data[TRANSFORM.pos_y], _m);
|
||||
|
||||
_y += tbh + ui(4);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Rotation"));
|
||||
rot.draw(tbx, _y, _w - lbw, tbh, _data[TRANSFORM.rot], _m);
|
||||
|
||||
_y += tbh + ui(4);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Scale"));
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, tbx, _y, _w - lbw, tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, tbx, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tbw = array_length(_data) > 4? (_w - lbw) / 2 : _w - lbw;
|
||||
|
||||
tb[TRANSFORM.sca_x].draw(tbx, _y, tbw, tbh, _data[TRANSFORM.sca_x], _m);
|
||||
if(array_length(_data) > 4)
|
||||
tb[TRANSFORM.sca_y].draw(tbx + tbw, _y, tbw, tbh, _data[TRANSFORM.sca_y], _m);
|
||||
if(true) { // new
|
||||
h = _h;
|
||||
|
||||
var _spc = ui(4);
|
||||
var _tbw = (w - _spc / 2) / array_length(_data);
|
||||
var _tbh = _h;
|
||||
var _tbx = _x;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tbx, _y, _tbw * 2, _tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tbx, _y, _tbw * 2, _tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tb[TRANSFORM.pos_x].draw(_tbx, _y, _tbw, _tbh, _data[TRANSFORM.pos_x], _m);
|
||||
tb[TRANSFORM.pos_y].draw(_tbx + _tbw, _y, _tbw, _tbh, _data[TRANSFORM.pos_y], _m);
|
||||
|
||||
_tbx += _tbw * 2 + _spc;
|
||||
|
||||
rot.draw(_tbx, _y, _tbw, _tbh, _data[TRANSFORM.rot], _m);
|
||||
|
||||
_tbx += _tbw + _spc;
|
||||
|
||||
if(array_length(_data) == 4) {
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tbx, _y, _tbw, _tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tbx, _y, _tbw, _tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tb[TRANSFORM.sca_x].draw(_tbx, _y, _tbw, _tbh, _data[TRANSFORM.sca_x], _m);
|
||||
|
||||
} else if(array_length(_data) == 5) {
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tbx, _y, _tbw * 2, _tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tbx, _y, _tbw * 2, _tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tb[TRANSFORM.sca_x].draw(_tbx, _y, _tbw, _tbh, _data[TRANSFORM.sca_x], _m);
|
||||
tb[TRANSFORM.sca_y].draw(_tbx + _tbw, _y, _tbw, _tbh, _data[TRANSFORM.sca_y], _m);
|
||||
}
|
||||
|
||||
} else {
|
||||
h = _h * 3 + ui(4) * 2;
|
||||
|
||||
var _lab = _w > ui(160);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
|
||||
var lbw = _lab? string_width(__txt("Position")) + ui(8) : 0;
|
||||
var tbw = (_w - lbw) / 2;
|
||||
var tbh = _h;
|
||||
var tbx = _x + lbw;
|
||||
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Position"));
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, tbx, _y, _w - lbw, tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, tbx, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tb[TRANSFORM.pos_x].draw(tbx, _y, tbw, tbh, _data[TRANSFORM.pos_x], _m);
|
||||
tb[TRANSFORM.pos_y].draw(tbx + tbw, _y, tbw, tbh, _data[TRANSFORM.pos_y], _m);
|
||||
|
||||
_y += tbh + ui(4);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Rotation"));
|
||||
rot.draw(tbx, _y, _w - lbw, tbh, _data[TRANSFORM.rot], _m);
|
||||
|
||||
_y += tbh + ui(4);
|
||||
|
||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Scale"));
|
||||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, tbx, _y, _w - lbw, tbh, boxColor, 1);
|
||||
draw_sprite_stretched_ext(THEME.textbox, 0, tbx, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||
|
||||
tbw = array_length(_data) > 4? (_w - lbw) / 2 : _w - lbw;
|
||||
|
||||
tb[TRANSFORM.sca_x].draw(tbx, _y, tbw, tbh, _data[TRANSFORM.sca_x], _m);
|
||||
if(array_length(_data) > 4)
|
||||
tb[TRANSFORM.sca_y].draw(tbx + tbw, _y, tbw, tbh, _data[TRANSFORM.sca_y], _m);
|
||||
}
|
||||
|
||||
resetFocus();
|
||||
|
||||
|
|
|
@ -2,8 +2,12 @@ function widget() constructor {
|
|||
active = false;
|
||||
hover = false;
|
||||
hovering = false;
|
||||
|
||||
iactive = false;
|
||||
ihover = false;
|
||||
|
||||
temp_hovering = false;
|
||||
|
||||
parent = noone;
|
||||
keyframe = noone;
|
||||
interactable = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue