Obj material fix

This commit is contained in:
Tanasart 2022-12-18 09:20:38 +07:00
parent 9c5e39a11f
commit 04e17c30f5
29 changed files with 488 additions and 400 deletions

View file

@ -948,8 +948,8 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics x2.ai","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",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Collections.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Assets.zip","CopyToMask":-1,"filePath":"datafiles/data",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Collections.zip","CopyToMask":-1,"filePath":"datafiles/data",},
],
"MetaData": {
"IDEVersion": "2022.11.1.56",

Binary file not shown.

View file

@ -2,17 +2,18 @@
event_inherited();
#region data
dialog_w = ui(600);
dialog_h = ui(360);
dialog_w = ui(720);
dialog_h = ui(480);
destroy_on_click_out = true;
note = "";
var link = "https://gist.githubusercontent.com/Ttanasart-pt/e7ab670299ce6b00cfd632646f3ac9a8/raw/0.9.0";
node_get = http_get(link);
var link = "https://gist.githubusercontent.com/Ttanasart-pt/e7ab670299ce6b00cfd632646f3ac9a8/raw/1.0.0";
note_get = http_get(link);
sp_note = new scrollPane(dialog_w - ui(80), dialog_h - ui(88), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);
BLEND_ADD
var yy = 0;
var txt = note;
@ -37,7 +38,7 @@ event_inherited();
switch(md) {
case "#" :
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text_title);
draw_set_text(f_h3, fa_left, fa_top, COLORS._main_text_title);
line = string_copy(line, sp + 1, string_length(line) - sp);
yy += ui(16);
draw_text_ext(xx, _y + yy, line, -1, ww);
@ -45,7 +46,14 @@ event_inherited();
yy += ui(4);
break;
case "##" :
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_title);
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text_title);
line = string_copy(line, sp + 1, string_length(line) - sp);
yy += ui(8);
draw_text_ext(xx + ui(16), _y + yy, line, -1, ww);
yy += ui(4);
break;
case "###" :
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_accent);
line = string_copy(line, sp + 1, string_length(line) - sp);
yy += ui(8);
draw_text_ext(xx + ui(16), _y + yy, line, -1, ww);
@ -72,6 +80,7 @@ event_inherited();
yy += string_height_ext(line, -1, ww);
}
BLEND_NORMAL
return yy + ui(64);
})
#endregion

View file

@ -1,5 +1,5 @@
/// @description init
if (ds_map_find_value(async_load, "id") == node_get) {
if (ds_map_find_value(async_load, "id") == note_get) {
if (ds_map_find_value(async_load, "status") == 0) {
note = ds_map_find_value(async_load, "result");
alarm[0] = 1;

View file

@ -8,8 +8,6 @@
file_text_close(f);
#endregion
//display_reset(8, 1);
#region window
depth = 0;
win_wp = WIN_W;

View file

@ -656,7 +656,7 @@ function gif_std_enum_getIndex() {
return _s + ")";
}
if (is_real(_value)) {
_s = string_format(_value, 0, 16);
_s = string(_value);
if (os_browser != -1) {
_n = string_length(_s);
_i = _n;

View file

@ -1,12 +1,10 @@
function Node_create_3D_Obj_path(_x, _y, _group = -1, path) {
function Node_create_3D_Obj_path(_x, _y, path) {
if(!file_exists(path)) return noone;
var node = new Node_3D_Obj(_x, _y, _group);
var node = new Node_3D_Obj(_x, _y);
node.inputs[| 0].setValue(path);
node.updateObj();
node.doUpdate();
//ds_list_add(PANEL_GRAPH.nodes_list, node);
return node;
}
@ -17,6 +15,7 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
uniLightNrm = shader_get_uniform(sh_vertex_pnt_light, "useNormal");
inputs[| 0] = nodeValue(0, "Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, "")
.setDisplay(VALUE_DISPLAY.path_load, [ "*.obj", "" ]);
@ -50,12 +49,15 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
inputs[| 9] = nodeValue(9, "Light color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white);
inputs[| 10] = nodeValue(10, "Ambient color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey);
inputs[| 11] = nodeValue(11, "Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1 ])
.setDisplay(VALUE_DISPLAY.vector);
input_display_list = [ 2,
["Geometry", false], 0, 1,
["Transform", false], 3, 4, 5,
["Textures", true],
["Transform", false], 3, 4, 5, 11,
["Light", false], 6, 7, 8, 9, 10,
["Textures", true],
];
input_length = ds_list_size(inputs);
input_display_len = array_length(input_display_list);
@ -99,6 +101,7 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
materialNames = [];
materialIndex = [];
materials = [];
use_normal = true;
static updateObj = function() {
var _path = inputs[| 0].getValue();
@ -109,9 +112,16 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
VB = _v[0];
materialNames = _v[1];
materialIndex = _v[2];
use_normal = _v[3];
}
materials = readMtl(_pathMtl);
if(array_length(materialNames))
materials = readMtl(_pathMtl);
else {
materialNames = ["Material"];
materialIndex = [0];
materials = [new MTLmaterial("Material")];
}
do_reset_material = true;
}
@ -241,6 +251,7 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
var _lint = inputs[| 8].getValue();
var _lclr = inputs[| 9].getValue();
var _aclr = inputs[| 10].getValue();
var _lsc = inputs[| 11].getValue();
var _outSurf = outputs[| 0].getValue();
if(!is_surface(_outSurf)) {
@ -263,15 +274,19 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
shader_set_uniform_i(uniLightNrm, use_normal);
camera_apply(cam);
draw_clear_alpha(0, 0);
matrix_stack_push(TM);
matrix_stack_push(matrix_build(0, 0, 0, 0, 0, 0, _lsc[0], _lsc[1], _lsc[2]));
matrix_set(matrix_world, matrix_stack_top());
for(var i = 0; i < array_length(VB); i++) {
if(i >= ds_list_size(inputs)) break;
if(i >= array_length(materialIndex)) continue;
var mIndex = materialIndex[i];
var tex = inputs[| input_length + mIndex].getValue();
@ -280,6 +295,7 @@ function Node_3D_Obj(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
}
shader_reset();
matrix_stack_pop();
matrix_stack_pop();
matrix_set(matrix_world, MATRIX_IDENTITY);
surface_reset_target();

View file

@ -5,6 +5,7 @@ function Node_3D_Extrude(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
uniLightNrm = shader_get_uniform(sh_vertex_pnt_light, "useNormal");
inputs[| 0] = nodeValue(0, "Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
@ -314,6 +315,8 @@ function Node_3D_Extrude(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
shader_set_uniform_i(uniLightNrm, 1);
camera_apply(cam);
draw_clear_alpha(0, 0);

View file

@ -5,6 +5,7 @@ function Node_3D_Cube(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
uniLightNrm = shader_get_uniform(sh_vertex_pnt_light, "useNormal");
inputs[| 0] = nodeValue(0, "Main texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE);
inputs[| 1] = nodeValue(1, "Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2)
@ -194,6 +195,8 @@ function Node_3D_Cube(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
shader_set_uniform_i(uniLightNrm, 1);
camera_apply(cam);
draw_clear_alpha(0, 0);

View file

@ -5,6 +5,7 @@ function Node_3D_Cylinder(_x, _y, _group = -1) : Node(_x, _y, _group) constructo
uniLightAmb = shader_get_uniform(sh_vertex_pnt_light, "u_AmbientLight");
uniLightClr = shader_get_uniform(sh_vertex_pnt_light, "u_LightColor");
uniLightInt = shader_get_uniform(sh_vertex_pnt_light, "u_LightIntensity");
uniLightNrm = shader_get_uniform(sh_vertex_pnt_light, "useNormal");
inputs[| 0] = nodeValue(0, "Sides", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 16);
@ -246,6 +247,8 @@ function Node_3D_Cylinder(_x, _y, _group = -1) : Node(_x, _y, _group) constructo
shader_set_uniform_f_array(uniLightAmb, colorArrayFromReal(_aclr));
shader_set_uniform_f_array(uniLightClr, colorArrayFromReal(_lclr));
shader_set_uniform_f(uniLightInt, _lint);
shader_set_uniform_i(uniLightNrm, 1);
camera_apply(cam);
draw_clear_alpha(0, 0);

View file

@ -27,8 +27,11 @@ function Node_9Slice(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) const
}
static drawOverlay = function(active, _x, _y, _s, _mx, _my) {
var _dim = inputs[| 1].getValue();
var _splice = inputs[| 2].getValue();
if(process_multiple) return;
if(array_length(current_data) < 1) return;
var _dim = current_data[1];
var _splice = current_data[2];
var sp_r = _x + (_dim[0] - _splice[0]) * _s;
var sp_l = _x + _splice[2] * _s;

View file

@ -65,8 +65,12 @@ function Node_VFX_Renderer(_x, _y, _group = -1) : Node(_x, _y, _group) construct
for( var i = input_index; i < ds_list_size(inputs) - 1; i++ ) {
var parts = inputs[| i].getValue(_time);
for(var j = 0; j < PREF_MAP[? "part_max_amount"]; j++)
if(!ds_exists(parts, ds_type_list)) continue;
for(var j = 0; j < ds_list_size(parts); j++) {
if(!parts[| j].active) continue;
parts[| j].draw(_exact);
}
}
gpu_set_blendmode(bm_normal);

View file

@ -445,7 +445,7 @@ function Node_Canvas(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
surface_set_target(_surf_prev);
draw_clear_alpha(0, 0);
draw_surface(_surf, 0, 0);
draw_surface_safe(_surf, 0, 0);
draw_set_color(_col);

View file

@ -537,6 +537,21 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) constructor {
static onDestroy = function() {}
static isRenderable = function(trigger = false) {
var _startNode = true;
for(var j = 0; j < ds_list_size(inputs); j++) {
var _in = inputs[| j];
if(_in.type == VALUE_TYPE.node) continue;
if(trigger)
triggerRender();
if(_in.value_from != noone && !_in.value_from.node.rendered)
_startNode = false;
}
return _startNode;
}
static getNextNodes = function() {
for(var i = 0; i < ds_list_size(outputs); i++) {
var _ot = outputs[| i];
@ -664,6 +679,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) constructor {
var _data = serialize();
_node.deserialize(ds_map_clone(_data));
_node.node_id = generateUUID();
NODE_MAP[? node_id] = self;
NODE_MAP[? _node.node_id] = _node;
return _node;

View file

@ -18,6 +18,7 @@ function Node_Pixel_Sort(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c
static process_data = function(_outSurf, _data, _output_index) {
var _in = _data[0];
var _it = _data[1];
var _tr = _data[2];
var _dr = floor(_data[3] / 90) % 4;
@ -33,7 +34,7 @@ function Node_Pixel_Sort(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c
surface_set_target(pp[1]);
draw_clear_alpha(0, 0);
BLEND_ADD
draw_surface(_in, 0, 0);
draw_surface_safe(_in, 0, 0);
BLEND_NORMAL
surface_reset_target();
@ -60,7 +61,7 @@ function Node_Pixel_Sort(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) c
surface_set_target(_outSurf);
BLEND_ADD
draw_surface(sBase, 0, 0);
draw_surface_safe(sBase, 0, 0);
BLEND_NORMAL
surface_reset_target();

View file

@ -6,6 +6,7 @@ enum ARRAY_PROCESS {
function Node_Processor(_x, _y, _group = -1) : Node(_x, _y, _group) constructor {
array_process = ARRAY_PROCESS.loop;
current_data = [];
process_multiple = false;
icon = THEME.node_processor;
@ -19,6 +20,8 @@ function Node_Processor(_x, _y, _group = -1) : Node(_x, _y, _group) constructor
len = max(len, array_length(_in));
}
process_multiple = len > 0;
for(var _oi = 0; _oi < ds_list_size(outputs); _oi++) {
if(outputs[| _oi].type != VALUE_TYPE.surface) continue;
var outSurfs = outputs[| _oi].getValue();

View file

@ -18,6 +18,11 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
NODE_CATEGORY = ds_list_create();
function nodeBuild(_name, _x, _y, _group = PANEL_GRAPH.getCurrentContext()) {
if(!ds_map_exists(ALL_NODES, _name)) {
log_warning("LOAD", "Node type " + _name + " not found");
return noone;
}
var _node = ALL_NODES[? _name];
return _node.build(_x, _y, _group);
}
@ -220,7 +225,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(node, "Group", s_node_group, "Node_Group", [1, Node_Group]);
addNodeObject(node, "Feedback", s_node_feedback, "Node_Feedback", [1, Node_Feedback]);
addNodeObject(node, "Loop", s_node_loop, "Node_Iterate", [1, Node_Iterate]);
addNodeObject(node, "Pin", s_node_pin, "Nodee_Pin", [1, Node_Pin]);
addNodeObject(node, "Pin", s_node_pin, "Node_Pin", [1, Node_Pin]);
addNodeObject(node, "Frame", s_node_frame, "Node_Frame", [1, Node_Frame]);
addNodeObject(node, "Display text", s_node_text, "Node_Display_Text", [1, Node_Display_Text]);
addNodeObject(node, "Display image", s_node_image, "Node_Display_Image", [0, Node_create_Display_Image]);

View file

@ -216,8 +216,8 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
var _txt = type == VALUE_TYPE.float? TEXTBOX_INPUT.float : TEXTBOX_INPUT.number;
switch(display_type) {
case VALUE_DISPLAY._default :
editWidget = new textBox(_txt, function(str) {
if(str != "") setValue(toNumber(str));
editWidget = new textBox(_txt, function(val) {
setValue(val);
} );
editWidget.slidable = true;
if(display_data != -1) editWidget.slide_speed = display_data;

View file

@ -3,8 +3,9 @@ function Node_Value_Processor(_x, _y, _group = -1) : Node(_x, _y, _group) constr
function process_value(_outindex) {
var _data = array_create(ds_list_size(inputs));
for(var i = 0; i < array_length(_data); i++)
for(var i = 0; i < array_length(_data); i++) {
_data[i] = inputs[| i].getValue();
}
return process_value_data(_data, _outindex);
}
@ -59,9 +60,9 @@ function Node_Value_Processor(_x, _y, _group = -1) : Node(_x, _y, _group) constr
_out[l] = process_value_data(_data, _outindex);
}
return _out;
} else {
return process_value(_outindex);
}
}
return process_value(_outindex);
}
static update = function() {

View file

@ -6,6 +6,7 @@ function readObj(path) {
var _VBN = [];
var mats = [];
var matIndex = [];
var use_normal = true;
var v = ds_list_create();
var vt = ds_list_create();
var vn = ds_list_create();
@ -38,7 +39,11 @@ function readObj(path) {
ds_list_add(f, [f1[0], f2[0], f3[0]]);
ds_list_add(ft, [f1[1], f2[1], f3[1]]);
ds_list_add(fn, [f1[2], f2[2], f3[2]]);
if(array_length(f1) > 2) ds_list_add(fn, [f1[2], f2[2], f3[2]]);
else {
ds_list_add(fn, [0, 0, 0]);
use_normal = false;
}
break;
case "usemtl" :
array_push_unique(mats, sep[1]);
@ -102,9 +107,9 @@ function readObj(path) {
var _ft3 = vt[| _ft[2] - 1];
var _fn = facen[| j];
var _fn1 = vn[| _fn[0] - 1];
var _fn2 = vn[| _fn[1] - 1];
var _fn3 = vn[| _fn[2] - 1];
var _fn1 = _fn[0]? vn[| _fn[0] - 1] : [0, 0, 0];
var _fn2 = _fn[1]? vn[| _fn[1] - 1] : [0, 0, 0];
var _fn3 = _fn[2]? vn[| _fn[2] - 1] : [0, 0, 0];
vertex_add_pnt(VB, _f1, _fn1, _ft1 );
vertex_add_pnt(VB, _f2, _fn2, _ft2 );
@ -126,5 +131,5 @@ function readObj(path) {
ds_list_destroy(ft);
ds_list_destroy(fn);
return [ VBS, mats, matIndex ];
return [ VBS, mats, matIndex, use_normal ];
}

View file

@ -130,14 +130,19 @@ function Panel_Animation() : PanelContent() constructor {
function arrangeKeys() {
var l = ds_list_create();
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var prop = anim_properties[| i];
if(!show_node_outside_context && prop.node.group != PANEL_GRAPH.getCurrentContext()) continue;
var node = anim_properties[| i];
if(!show_node_outside_context && node.group != PANEL_GRAPH.getCurrentContext()) continue;
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var keyframe = prop.animator.values[| k];
for( var j = 0; j < ds_list_size(node.inputs); j++ ) {
var prop = node.inputs[| j];
if(!prop.animator.is_anim) continue;
if(ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(l, keyframe);
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var keyframe = prop.animator.values[| k];
if(ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(l, keyframe);
}
}
}
@ -280,11 +285,14 @@ function Panel_Animation() : PanelContent() constructor {
if(!_node.active) continue;
var is_anim = false;
for(var j = 0; j < ds_list_size(_node.inputs); j++) {
var jun = _node.inputs[| j];
if(jun.animator.is_anim)
ds_priority_add(pr, jun, _node.anim_priority);
is_anim |= jun.animator.is_anim;
}
if(!is_anim) continue;
ds_priority_add(pr, _node, _node.anim_priority);
}
anim_properties = ds_priority_to_list(pr);
@ -350,12 +358,16 @@ function Panel_Animation() : PanelContent() constructor {
var index = 0, key_y = timeline_h / 2;
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var prop = anim_properties[| i];
if(!show_node_outside_context && prop.node.group != PANEL_GRAPH.getCurrentContext()) continue;
var node = anim_properties[| i];
if(!show_node_outside_context && node.group != PANEL_GRAPH.getCurrentContext()) continue;
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var t = (prop.animator.values[| k].time + 1) * ui(timeline_scale) + timeline_shift;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 1, t, key_y, 1, COLORS.panel_animation_keyframe_hide);
for( var j = 0; j < ds_list_size(node.inputs); j++ ) {
var prop = node.inputs[| j];
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var t = (prop.animator.values[| k].time + 1) * ui(timeline_scale) + timeline_shift;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 1, t, key_y, 1, COLORS.panel_animation_keyframe_hide);
}
}
}
#endregion
@ -462,7 +474,7 @@ function Panel_Animation() : PanelContent() constructor {
for(var k = 0; k < amo; k++) {
var key = prop.animator.values[| k];
var t = (key.time + 1) * ui(timeline_scale) + timeline_shift;
#region easing line
if(key.ease_in > 0) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
@ -502,66 +514,67 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_ui_uniform(THEME.timeline_keyframe, 3, _tx, key_y, 1, COLORS.panel_animation_keyframe_unselected);
}
#endregion
if(prop.animator.show_graph && k < amo - 1) { //graph
var key_next = prop.animator.values[| k + 1];
var a = key.ease_out;
var b = key_next.ease_in;
var dx = key_next.time - key.time;
var tott = a + b;
var ox = 0, oy = 0, nx = 0, ny = 0, oly = 0, nly = 0;
if(!prop.animator.show_graph) continue;
if(k >= amo - 1) continue;
var key_next = prop.animator.values[| k + 1];
var a = key.ease_out;
var b = key_next.ease_in;
var dx = key_next.time - key.time;
var tott = a + b;
var ox = 0, oy = 0, nx = 0, ny = 0, oly = 0, nly = 0;
if(tott == 0) {
nx = (key_next.time + 1) * ui(timeline_scale) + timeline_shift;
if(is_array(key.value)) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
oy = value_map(key.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
ny = value_map(key_next.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy, nx, ny);
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
var oy = value_map(key.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
var ny = value_map(key_next.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(tott == 0) {
nx = (key_next.time + 1) * ui(timeline_scale) + timeline_shift;
if(is_array(key.value)) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
oy = value_map(key.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
ny = value_map(key_next.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy, nx, ny);
}
} else {
a = a;
b = 1 - b;
draw_set_color(COLORS.panel_animation_graph_line);
var oy = value_map(key.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
var ny = value_map(key_next.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy, nx, ny);
}
} else {
a = a;
b = 1 - b;
var _step = 1 / 20;
for( var _r = 0; _r <= 1; _r += _step ) {
nx = t + _r * dx * ui(timeline_scale);
var nly = prop.animator.interpolate(key, key_next, _r);
var _step = 1 / 20;
for( var _r = 0; _r <= 1; _r += _step ) {
nx = t + _r * dx * ui(timeline_scale);
var nly = prop.animator.interpolate(key, key_next, _r);
if(is_array(key.value)) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
ny = value_map(lerp(key.value[ki], key_next.value[ki], nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(is_array(key.value)) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
ny = value_map(lerp(key.value[ki], key_next.value[ki], nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(_r > 0) {
draw_set_color(COLORS.axis[ki]);
oy = value_map(lerp(key.value[ki], key_next.value[ki], oly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(ox, oy, nx, ny);
}
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
ny = value_map(lerp(key.value, key_next.value, nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(_r > 0) {
oy = value_map(lerp(key.value, key_next.value, oly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_set_color(COLORS.axis[ki]);
oy = value_map(lerp(key.value[ki], key_next.value[ki], oly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(ox, oy, nx, ny);
}
}
ox = nx;
oly = nly;
} else {
draw_set_color(COLORS.panel_animation_graph_line);
ny = value_map(lerp(key.value, key_next.value, nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(_r > 0) {
oy = value_map(lerp(key.value, key_next.value, oly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(ox, oy, nx, ny);
}
}
ox = nx;
oly = nly;
}
}
}
if(prop.animator.show_graph && ds_list_size(prop.animator.values) > 0) {
if(prop.animator.show_graph && ds_list_size(prop.animator.values) > 0) { //
var key_first = prop.animator.values[| 0];
var t_first = (key_first.time + 1) * ui(timeline_scale) + timeline_shift;
@ -608,175 +621,180 @@ function Panel_Animation() : PanelContent() constructor {
var hoverIndex = 0;
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var prop = anim_properties[| i];
if(!show_node_outside_context && prop.node.group != PANEL_GRAPH.getCurrentContext()) continue;
var aa = prop.node.group == PANEL_GRAPH.getCurrentContext()? 1 : 0.9;
_node = anim_properties[| i];
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
if(_node != prop.node) {
key_y += dope_sheet_node_padding;
var _ky = key_y - ui(10);
if(_node != noone && pHOVER && point_in_rectangle(msx, msy, 0, i <= 1? -ui(64) : _node_y, lable_w, _ky - ui(2)))
hovering = _node;
_node_y = _ky;
_node = prop.node;
if(pHOVER && point_in_rectangle(msx, msy, ui(20), key_y - ui(10), lable_w, key_y + ui(10))) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(10), lable_w, ui(20), COLORS.panel_animation_dope_bg_hover, aa);
if(mouse_press(mb_left, pFOCUS))
node_ordering = _node;
} else
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(10), lable_w, ui(20), COLORS.panel_animation_dope_bg, aa);
if(_node == PANEL_INSPECTOR.inspecting)
draw_sprite_stretched_ext(THEME.node_active, 0, 0, key_y - ui(10), lable_w, ui(20), COLORS._main_accent, 1);
var tx = tool_width - ui(76 + 16 * 0);
if(pHOVER && point_in_circle(msx, msy, tx, key_y - 1, ui(10))) {
draw_sprite_ui_uniform(THEME.animate_node_go, 0, tx, key_y - 1, 1, COLORS._main_icon_light, 1);
TOOLTIP = "Go to node";
if(mouse_press(mb_left, pFOCUS)) {
PANEL_INSPECTOR.inspecting = _node;
ds_list_clear(PANEL_GRAPH.nodes_select_list);
PANEL_GRAPH.node_focus = _node;
PANEL_GRAPH.fullView();
}
} else
draw_sprite_ui_uniform(THEME.animate_node_go, 0, tx, key_y - 1, 1, COLORS._main_icon, 0.75);
if(pHOVER && point_in_rectangle(msx, msy, 0, key_y - ui(10), ui(20), key_y + ui(10))) {
draw_sprite_ui_uniform(THEME.arrow, _node.anim_show? 3 : 0, ui(10), key_y, 1, COLORS._main_icon_light, 1);
if(mouse_press(mb_left, pFOCUS))
_node.anim_show = !_node.anim_show;
} else
draw_sprite_ui_uniform(THEME.arrow, _node.anim_show? 3 : 0, ui(10), key_y, 1, COLORS._main_icon, 0.75);
draw_set_color(node_ordering == _node? COLORS._main_text_accent : COLORS._main_text_sub);
draw_set_alpha(aa);
draw_text(ui(20), key_y - ui(2), _node.name);
draw_set_alpha(1);
key_y += ui(22);
}
if(!prop.node.anim_show) continue;
var tx = tool_width - ui(72 + 16 * 3);
var ty = key_y - 1;
var aa = _node.group == PANEL_GRAPH.getCurrentContext()? 1 : 0.9;
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 1);
key_y += dope_sheet_node_padding;
_node_y = key_y - ui(10);
var _node_y_start = _node_y;
if(pHOVER && point_in_rectangle(msx, msy, ui(20), key_y - ui(10), lable_w, key_y + ui(10))) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(10), lable_w, ui(20), COLORS.panel_animation_dope_bg_hover, aa);
if(mouse_press(mb_left, pFOCUS))
node_ordering = _node;
} else
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(10), lable_w, ui(20), COLORS.panel_animation_dope_bg, aa);
if(_node == PANEL_INSPECTOR.inspecting)
draw_sprite_stretched_ext(THEME.node_active, 0, 0, key_y - ui(10), lable_w, ui(20), COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _t = -1;
for(var j = 0; j < ds_list_size(prop.animator.values); j++) {
var _key = prop.animator.values[| j];
if(_key.time < ANIMATOR.current_frame) {
_t = _key.time;
}
}
if(_t > -1) ANIMATOR.setFrame(_t);
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 0.75);
var tx = tool_width - ui(72 + 16 * 1);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
for(var j = 0; j < ds_list_size(prop.animator.values); j++) {
var _key = prop.animator.values[| j];
if(_key.time > ANIMATOR.current_frame) {
ANIMATOR.setFrame(_key.time);
break;
}
}
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 0.75);
var tx = tool_width - ui(72 + 16 * 2);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _add = false;
for(var j = 0; j < ds_list_size(prop.animator.values); j++) {
var _key = prop.animator.values[| j];
if(_key.time == ANIMATOR.current_frame) {
if(ds_list_size(prop.animator.values) > 1)
ds_list_delete(prop.animator.values, j);
_add = true;
break;
} else if(_key.time > ANIMATOR.current_frame) {
ds_list_insert(prop.animator.values, j, new valueKey(ANIMATOR.current_frame, prop.getValue(), prop.animator));
_add = true;
break;
}
}
if(!_add) ds_list_add(prop.animator.values, new valueKey(ANIMATOR.current_frame, prop.getValue(), prop.animator));
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 0.75);
if(isGraphable(prop.type)) {
var tx = tool_width - ui(68 + 16 * 0);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(8))) {
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, COLORS._main_icon, prop.animator.show_graph? 1 : 0.75);
TOOLTIP = "Show graph";
var tx = tool_width - ui(76 + 16 * 0);
if(pHOVER && point_in_circle(msx, msy, tx, key_y - 1, ui(10))) {
draw_sprite_ui_uniform(THEME.animate_node_go, 0, tx, key_y - 1, 1, COLORS._main_icon_light, 1);
TOOLTIP = "Go to node";
if(mouse_press(mb_left, pFOCUS)) {
prop.animator.show_graph = !prop.animator.show_graph;
}
} else
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, prop.animator.show_graph? COLORS._main_accent : COLORS._main_icon);
}
var tx = tool_width - ui(72 + 16 * 4.5);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon, 1);
TOOLTIP = "Looping mode " + ON_END_NAME[prop.on_end];
if(mouse_press(mb_left, pFOCUS)) {
prop.on_end = safe_mod(prop.on_end + 1, sprite_get_number(THEME.prop_on_end));
PANEL_INSPECTOR.inspecting = _node;
ds_list_clear(PANEL_GRAPH.nodes_select_list);
PANEL_GRAPH.node_focus = _node;
PANEL_GRAPH.fullView();
}
} else
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon, 0.75);
if(pHOVER && point_in_circle(msx, msy, ui(22), key_y - 1, ui(10))) {
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), key_y - 1, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
prop.animator.is_anim = !prop.animator.is_anim;
updatePropertyList();
}
draw_sprite_ui_uniform(THEME.animate_node_go, 0, tx, key_y - 1, 1, COLORS._main_icon, 0.75);
if(pHOVER && point_in_rectangle(msx, msy, 0, key_y - ui(10), ui(20), key_y + ui(10))) {
draw_sprite_ui_uniform(THEME.arrow, _node.anim_show? 3 : 0, ui(10), key_y, 1, COLORS._main_icon_light, 1);
if(mouse_press(mb_left, pFOCUS))
_node.anim_show = !_node.anim_show;
} else
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), key_y - 1, 1, COLORS._main_icon, 0.75);
draw_set_color(COLORS._main_text);
draw_sprite_ui_uniform(THEME.arrow, _node.anim_show? 3 : 0, ui(10), key_y, 1, COLORS._main_icon, 0.75);
draw_set_color(node_ordering == _node? COLORS._main_text_accent : COLORS._main_text_sub);
draw_set_alpha(aa);
draw_text(ui(32), key_y - 2, prop.name);
draw_text(ui(20), key_y - ui(2), _node.name);
draw_set_alpha(1);
if(prop.animator.show_graph)
key_y += graph_h + ui(8);
key_y += ui(22);
if(!_node.anim_show) {
if(pHOVER && point_in_rectangle(msx, msy, 0, _node_y_start, lable_w, key_y))
hovering = _node;
continue;
}
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
var tx = tool_width - ui(72 + 16 * 3);
var ty = key_y - 1;
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 1);
key_y += ui(18);
}
if(mouse_press(mb_left, pFOCUS)) {
var _t = -1;
for(var j = 0; j < ds_list_size(prop.animator.values); j++) {
var _key = prop.animator.values[| j];
if(_key.time < ANIMATOR.current_frame) {
_t = _key.time;
}
}
if(_t > -1) ANIMATOR.setFrame(_t);
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 0.75);
var tx = tool_width - ui(72 + 16 * 1);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
for(var j = 0; j < ds_list_size(prop.animator.values); j++) {
var _key = prop.animator.values[| j];
if(_key.time > ANIMATOR.current_frame) {
ANIMATOR.setFrame(_key.time);
break;
}
}
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 0.75);
var tx = tool_width - ui(72 + 16 * 2);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _add = false;
for(var j = 0; j < ds_list_size(prop.animator.values); j++) {
var _key = prop.animator.values[| j];
if(_key.time == ANIMATOR.current_frame) {
if(ds_list_size(prop.animator.values) > 1)
ds_list_delete(prop.animator.values, j);
_add = true;
break;
} else if(_key.time > ANIMATOR.current_frame) {
ds_list_insert(prop.animator.values, j, new valueKey(ANIMATOR.current_frame, prop.getValue(), prop.animator));
_add = true;
break;
}
}
if(!_add) ds_list_add(prop.animator.values, new valueKey(ANIMATOR.current_frame, prop.getValue(), prop.animator));
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 0.75);
if(isGraphable(prop.type)) {
var tx = tool_width - ui(68 + 16 * 0);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(8))) {
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, COLORS._main_icon, prop.animator.show_graph? 1 : 0.75);
TOOLTIP = "Show graph";
if(mouse_press(mb_left, pFOCUS)) {
prop.animator.show_graph = !prop.animator.show_graph;
}
} else
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, prop.animator.show_graph? COLORS._main_accent : COLORS._main_icon);
}
var tx = tool_width - ui(72 + 16 * 4.5);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon, 1);
TOOLTIP = "Looping mode: " + ON_END_NAME[prop.on_end];
if(mouse_press(mb_left, pFOCUS))
prop.on_end = safe_mod(prop.on_end + 1, sprite_get_number(THEME.prop_on_end));
} else
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon, 0.75);
if(pHOVER && point_in_circle(msx, msy, ui(22), key_y - 1, ui(10))) {
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), key_y - 1, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
prop.animator.is_anim = !prop.animator.is_anim;
updatePropertyList();
}
} else
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), key_y - 1, 1, COLORS._main_icon, 0.75);
draw_set_color(COLORS._main_text);
draw_set_alpha(aa);
draw_text(ui(32), key_y - 2, prop.name);
draw_set_alpha(1);
if(prop.animator.show_graph)
key_y += graph_h + ui(8);
key_y += ui(18);
} //end prop loop
if(pHOVER && point_in_rectangle(msx, msy, 0, _node_y_start, lable_w, key_y))
hovering = _node;
} //end node loop
if(hovering == noone && _node != noone)
hovering = _node;
if(hovering != noone) {
if(hovering != noone && node_ordering != noone) {
hoverIndex = hovering.anim_priority;
if(node_ordering != noone) {
rearrange_priority(node_ordering, hoverIndex);
rearrange_priority(node_ordering, hoverIndex);
if(mouse_release(mb_left))
node_ordering = noone;
}
if(mouse_release(mb_left))
node_ordering = noone;
}
surface_reset_target();
@ -844,23 +862,24 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, timeline_shift, 0, bar_total_w, dope_sheet_h, COLORS.panel_animation_timeline_blend, 1);
dope_sheet_y_max = 0;
var key_y = ui(24) + dope_sheet_y, key_y_node, _node = noone;
var key_y = ui(24) + dope_sheet_y, key_y_node;
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var prop = anim_properties[| i];
if(!show_node_outside_context && prop.node.group != PANEL_GRAPH.getCurrentContext()) continue;
if(_node != prop.node) {
_node = prop.node;
key_y += dope_sheet_node_padding;
key_y_node = key_y;
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(10), bar_total_w, ui(20), COLORS.panel_animation_node_bg, 1);
key_y += ui(22);
dope_sheet_y_max += ui(28);
}
if(prop.node.anim_show) {
var _node = anim_properties[| i];
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
key_y += dope_sheet_node_padding;
key_y_node = key_y;
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(10), bar_total_w, ui(20), COLORS.panel_animation_node_bg, 1);
key_y += ui(22);
dope_sheet_y_max += ui(28);
if(!_node.anim_show) continue;
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
key_y += ui(18);
dope_sheet_y_max += ui(18);
@ -871,7 +890,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
}
dope_sheet_y_max = max(0, dope_sheet_y_max - dope_sheet_h + ui(48));
for(var i = 10; i <= ANIMATOR.frames_total; i += 10) {
@ -949,52 +968,54 @@ function Panel_Animation() : PanelContent() constructor {
#endregion
var key_sy = ui(24) + dope_sheet_y;
var key_y, key_y_node, _node = noone;
var key_y, key_y_node;
draw_set_text(f_p2, fa_left, fa_top);
var key_hover = noone;
key_y = key_sy;
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var prop = anim_properties[| i];
if(!show_node_outside_context && prop.node.group != PANEL_GRAPH.getCurrentContext()) continue;
if(_node != prop.node) {
_node = prop.node;
#region draw graph
key_y = key_sy;
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var _node = anim_properties[| i];
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
key_y += ui(22) + dope_sheet_node_padding;
}
if(!prop.node.anim_show) continue;
var key_list = prop.animator.values;
if(prop.node.anim_show && prop.on_end != KEYFRAME_END.hold && ds_list_size(key_list) > 1) {
var keyframe_s = key_list[| 0].time;
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
if(!_node.anim_show) continue;
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
var key_list = prop.animator.values;
if(prop.on_end != KEYFRAME_END.hold && ds_list_size(key_list) > 1) {
var keyframe_s = key_list[| 0].time;
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
var ks_x = keyframe_s * ui(timeline_scale) + timeline_shift;
var ke_x = keyframe_e * ui(timeline_scale) + timeline_shift;
var ks_x = (keyframe_s + 1) * ui(timeline_scale) + timeline_shift;
var ke_x = (keyframe_e + 1) * ui(timeline_scale) + timeline_shift;
draw_set_color(COLORS.panel_animation_loop_line);
draw_set_alpha(0.2);
draw_line_width(ks_x, key_y - 1, ke_x, key_y - 1, 4);
draw_set_alpha(1);
}
if(!isGraphable(prop.type)) {
key_y += ui(18);
continue;
}
var _key = drawDopesheetGraph(prop, key_y, msx, msy);
if(_key) key_hover = _key;
draw_set_color(COLORS.panel_animation_loop_line);
draw_set_alpha(0.2);
draw_line_width(ks_x, key_y - 1, ke_x, key_y - 1, 4);
draw_set_alpha(1);
}
if(!isGraphable(prop.type)) {
key_y += ui(18);
continue;
}
var _key = drawDopesheetGraph(prop, key_y, msx, msy);
if(_key) key_hover = _key;
if(prop.animator.show_graph && ds_list_size(prop.animator.values) > 0)
key_y += graph_h + ui(8);
if(prop.animator.show_graph && ds_list_size(prop.animator.values) > 0)
key_y += graph_h + ui(8);
key_y += ui(18);
}
key_y += ui(18);
}
}
#endregion
key_y = key_sy;
_node = noone;
if(keyframe_boxing) {
draw_set_color(COLORS._main_accent);
@ -1006,71 +1027,72 @@ function Panel_Animation() : PanelContent() constructor {
if(mouse_release(mb_left))
keyframe_boxing = false;
}
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var prop = anim_properties[| i];
if(!show_node_outside_context && prop.node.group != PANEL_GRAPH.getCurrentContext()) continue;
if(_node != prop.node) {
_node = prop.node;
#region draw keys
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var _node = anim_properties[| i];
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
key_y += dope_sheet_node_padding;
key_y_node = key_y;
key_y += ui(22);
}
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var t = (prop.animator.values[| k].time + 1) * ui(timeline_scale) + timeline_shift;
var keyframe = prop.animator.values[| k];
if(!prop.node.anim_show) {
draw_sprite_ui_uniform(THEME.timeline_keyframe, 0, t, key_y_node, 1, COLORS.panel_animation_keyframe_hide);
continue;
}
var cc = COLORS.panel_animation_keyframe_unselected;
if(pHOVER && point_in_circle(msx, msy, t, key_y, ui(8))) {
cc = COLORS.panel_animation_keyframe_selected;
key_hover = keyframe;
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var t = (prop.animator.values[| k].time + 1) * ui(timeline_scale) + timeline_shift;
var keyframe = prop.animator.values[| k];
draw_sprite_ui_uniform(THEME.timeline_keyframe, 0, t, key_y_node, 1, COLORS._main_icon);
if(!_node.anim_show) continue;
var cc = COLORS.panel_animation_keyframe_unselected;
if(pHOVER && point_in_circle(msx, msy, t, key_y, ui(8))) {
cc = COLORS.panel_animation_keyframe_selected;
key_hover = keyframe;
if(pFOCUS) {
if(DOUBLE_CLICK) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_both;
} else if(mouse_press(mb_left)) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
if(pFOCUS) {
if(DOUBLE_CLICK) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_both;
} else if(mouse_press(mb_left)) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
}
}
}
if(stagger_mode == 1 && ds_list_exist(keyframe_selecting, keyframe))
cc = key_hover == keyframe? COLORS.panel_animation_keyframe_selected : COLORS._main_accent;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 1, t, key_y, 1, cc);
if(ds_list_exist(keyframe_selecting, keyframe))
draw_sprite_ui_uniform(THEME.timeline_keyframe_selecting, 0, t, key_y, 1, COLORS._main_accent);
if(keyframe_boxing) {
var box_x0 = min(keyframe_box_sx, msx);
var box_x1 = max(keyframe_box_sx, msx);
var box_y0 = min(keyframe_box_sy, msy);
var box_y1 = max(keyframe_box_sy, msy);
if(pHOVER && !point_in_rectangle(t, key_y, box_x0, box_y0, box_x1, box_y1) && ds_list_exist(keyframe_selecting, keyframe))
ds_list_remove(keyframe_selecting, keyframe);
if(pHOVER && point_in_rectangle(t, key_y, box_x0, box_y0, box_x1, box_y1) && !ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(keyframe_selecting, keyframe);
}
}
}
if(stagger_mode == 1 && ds_list_exist(keyframe_selecting, keyframe))
cc = key_hover == keyframe? COLORS.panel_animation_keyframe_selected : COLORS._main_accent;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 1, t, key_y, 1, cc);
if(ds_list_exist(keyframe_selecting, keyframe))
draw_sprite_ui_uniform(THEME.timeline_keyframe_selecting, 0, t, key_y, 1, COLORS._main_accent);
if(keyframe_boxing) {
var box_x0 = min(keyframe_box_sx, msx);
var box_x1 = max(keyframe_box_sx, msx);
var box_y0 = min(keyframe_box_sy, msy);
var box_y1 = max(keyframe_box_sy, msy);
if(pHOVER && !point_in_rectangle(t, key_y, box_x0, box_y0, box_x1, box_y1) && ds_list_exist(keyframe_selecting, keyframe))
ds_list_remove(keyframe_selecting, keyframe);
if(pHOVER && point_in_rectangle(t, key_y, box_x0, box_y0, box_x1, box_y1) && !ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(keyframe_selecting, keyframe);
if(_node.anim_show) {
if(prop.animator.show_graph)
key_y += graph_h + ui(8);
key_y += 18;
}
}
}
if(prop.node.anim_show) {
if(prop.animator.show_graph)
key_y += graph_h + ui(8);
key_y += 18;
}
}
#endregion
if(pHOVER && point_in_rectangle(msx, msy, 0, ui(16), dope_sheet_w, dope_sheet_h)) {
if(mouse_press(mb_left, pFOCUS) || mouse_press(mb_right, pFOCUS)) {

View file

@ -690,6 +690,8 @@ function Panel_Graph() : PanelContent() constructor {
node_drag_my = 0;
node_drag_sx = 0;
node_drag_sy = 0;
PANEL_ANIMATION.updatePropertyList();
}
function doBlend() {

View file

@ -11,16 +11,7 @@ function __nodeLeafList(_list, _stack) {
var _node = _list[| i];
if(!_node.active) continue;
var _startNode = true;
for(var j = 0; j < ds_list_size(_node.inputs); j++) {
var _in = _node.inputs[| j];
if(_in.type == VALUE_TYPE.node) continue;
_node.triggerRender();
if(_in.value_from != noone && !_in.value_from.node.rendered)
_startNode = false;
}
var _startNode = _node.isRenderable(true);
if(_startNode) {
ds_stack_push(_stack, _node);
printIf(global.RENDER_LOG, "Push node " + _node.name + " to stack");
@ -71,14 +62,7 @@ function Render(partial = false) {
if(_node.rendered) continue;
if(__nodeInLoop(_node)) continue;
var _startNode = true;
for(var j = 0; j < ds_list_size(_node.inputs); j++) {
var _in = _node.inputs[| j];
if(_in.type == VALUE_TYPE.node) continue;
if(_in.value_from != noone && !_in.value_from.node.rendered)
_startNode = false;
}
var _startNode = _node.isRenderable();
if(_startNode) {
ds_stack_push(RENDER_STACK, _node);
printIf(global.RENDER_LOG, " > Push " + _node.name + " node to stack");

View file

@ -4,8 +4,8 @@ function __init_theme() {
directory_create(root);
var _l = root + "\\_theme" + string(VERSION);
//if(file_exists(_l)) return;
//log_message("THEME", "unzipping default theme to DIRECTORY.");
if(file_exists(_l)) return;
log_message("THEME", "unzipping default theme to DIRECTORY.");
var f = file_text_open_write(_l);
file_text_write_real(f, 0);
file_text_close(f);

View file

@ -60,6 +60,6 @@ function toNumber(str) {
str = string_decimal(str);
if(str == "") return 0;
if(str == ".") return 0;
if(str == "-") return 0;
if(str == "-") return 0;
return real(str);
}

View file

@ -182,7 +182,8 @@
case "t": ds_stack_push(vl, _x); break;
case "pi": ds_stack_push(vl, pi); break;
default : ds_stack_push(vl, toNumber(vsl));
default :
ds_stack_push(vl, toNumber(vsl));
break;
}
}

View file

@ -35,7 +35,7 @@ function surface_copy_add(dst, src, _x = 0, _y = 0) {
surface_set_target(dst);
draw_clear_alpha(0, 0);
BLEND_ADD
draw_surface(src, _x, _y);
draw_surface_safe(src, _x, _y);
BLEND_NORMAL
surface_reset_target();
}

View file

@ -27,7 +27,7 @@ function textBox(_input, _onModify) constructor {
onModify = _onModify;
_input_text = "";
_last_value = "";
_last_text = "";
cursor = 0;
cursor_pos = 0;
@ -53,7 +53,7 @@ function textBox(_input, _onModify) constructor {
}
if(no_empty && _input_text_current == "")
_input_text_current = _last_value;
_input_text_current = _last_text;
if(onModify)
onModify(_input_text_current);
}
@ -63,6 +63,11 @@ function textBox(_input, _onModify) constructor {
cursor = safe_mod(cursor + delta + ll, ll);
}
static getDisplayText = function(val) {
if(input == TEXTBOX_INPUT.text) return val;
return string(val);
}
static editText = function() {
#region text editor
if(keyboard_check(vk_control) && keyboard_check_pressed(ord("A"))) {
@ -144,7 +149,7 @@ function textBox(_input, _onModify) constructor {
#endregion
if(keyboard_check_pressed(vk_escape)) {
_input_text = _last_value;
_input_text = _last_text;
apply();
TEXTBOX_ACTIVE = noone;
} else if(keyboard_check_pressed(vk_enter)) {
@ -273,10 +278,8 @@ function textBox(_input, _onModify) constructor {
_input_text = slide_sx + spd;
switch(input) {
case TEXTBOX_INPUT.number :
_input_text = round(_input_text);
break;
}
case TEXTBOX_INPUT.number : _input_text = round(_input_text); break;
}
apply();
UNDO_HOLDING = true;
@ -346,7 +349,8 @@ function textBox(_input, _onModify) constructor {
#endregion
#region draw
var ss = string_cut(_input_text, _w - ui(16));
var disp_text = getDisplayText(_input_text);
var ss = string_cut(disp_text, _w - ui(16));
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top);
var ww = string_width(ss);
@ -366,7 +370,7 @@ function textBox(_input, _onModify) constructor {
if(cursor_select > -1) {
draw_set_color(COLORS.widget_text_highlight);
var x1 = tx + string_width(string_copy(_input_text, 1, cursor_select));
var x1 = tx + string_width(string_copy(disp_text, 1, cursor_select));
draw_roundrect_ext(cursor_pos, c_y0, x1, c_y1, ui(8), ui(8), 0);
}
@ -388,7 +392,7 @@ function textBox(_input, _onModify) constructor {
TEXTBOX_ACTIVE = noone;
}
} else {
var ss = string_cut(string(_text), _w - 16);
var ss = string_cut(getDisplayText(_text), _w - 16);
draw_set_text(font == noone? f_p0 : font, fa_left, fa_center);
var ww = string_width(ss);
@ -409,8 +413,8 @@ function textBox(_input, _onModify) constructor {
KEYBOARD_STRING = "";
keyboard_lastkey = -1;
_input_text = _text;
_last_value = _text;
_input_text = _text;
_last_text = _text;
}
} else if(!hide) {
draw_sprite_stretched(THEME.textbox, 0, _x, _y, _w, hh);
@ -425,7 +429,7 @@ function textBox(_input, _onModify) constructor {
if(mouse_press(mb_left, active)) {
sliding = 1;
slide_mx = _m[0];
slide_sx = _last_value;
slide_sx = toNumber(_text);
}
}
}

View file

@ -7,13 +7,17 @@ varying float v_vNormalLight;
uniform vec3 u_AmbientLight;
uniform vec3 u_LightColor;
uniform float u_LightIntensity;
uniform int useNormal;
void main() {
vec4 dif = texture2D( gm_BaseTexture, v_vTexcoord );
vec4 lig = dif * (u_LightIntensity * vec4(u_LightColor, 1.));
vec4 amb = dif * vec4(u_AmbientLight, 1.);
float intensity = min(v_vNormalLight * u_LightIntensity, 1.);
vec4 clr = mix(amb, lig, intensity);
clr.a = dif.a;
gl_FragColor = clr;
if(useNormal == 1) {
vec4 lig = dif * (u_LightIntensity * vec4(u_LightColor, 1.));
vec4 amb = dif * vec4(u_AmbientLight, 1.);
float intensity = min(v_vNormalLight * u_LightIntensity, 1.);
vec4 clr = mix(amb, lig, intensity);
clr.a = dif.a;
gl_FragColor = clr;
} else
gl_FragColor = dif;
}