minits fixes
This commit is contained in:
+86
-5
@@ -476,7 +476,7 @@ function history_edit_nodes(canvas: zui_node_canvas_t, canvas_group: i32 = -1) {
|
||||
///if (is_paint || is_sculpt)
|
||||
step.canvas_type = canvas_type;
|
||||
///end
|
||||
step.canvas = json_parse(json_stringify(canvas));
|
||||
step.canvas = history_clone_canvas(canvas);
|
||||
}
|
||||
|
||||
///if (is_paint || is_sculpt)
|
||||
@@ -599,26 +599,26 @@ function history_layer_blending() {
|
||||
function history_new_material() {
|
||||
let step: step_t = history_push(tr("New Material"));
|
||||
step.canvas_type = 0;
|
||||
step.canvas = json_parse(json_stringify(context_raw.material.canvas));
|
||||
step.canvas = history_clone_canvas(context_raw.material.canvas);
|
||||
}
|
||||
|
||||
function history_delete_material() {
|
||||
let step: step_t = history_push(tr("Delete Material"));
|
||||
step.canvas_type = 0;
|
||||
step.canvas = json_parse(json_stringify(context_raw.material.canvas));
|
||||
step.canvas = history_clone_canvas(context_raw.material.canvas);
|
||||
}
|
||||
|
||||
function history_duplicate_material() {
|
||||
let step: step_t = history_push(tr("Duplicate Material"));
|
||||
step.canvas_type = 0;
|
||||
step.canvas = json_parse(json_stringify(context_raw.material.canvas));
|
||||
step.canvas = history_clone_canvas(context_raw.material.canvas);
|
||||
}
|
||||
|
||||
function history_delete_material_group(group: node_group_t) {
|
||||
let step: step_t = history_push(tr("Delete Node Group"));
|
||||
step.canvas_type = canvas_type_t.MATERIAL;
|
||||
step.canvas_group = array_index_of(project_material_groups, group);
|
||||
step.canvas = json_parse(json_stringify(group.canvas));
|
||||
step.canvas = history_clone_canvas(group.canvas);
|
||||
}
|
||||
///end
|
||||
|
||||
@@ -781,6 +781,87 @@ function history_swap_canvas(step: step_t) {
|
||||
ui_nodes_hwnd.redraws = 2;
|
||||
}
|
||||
|
||||
function history_clone_canvas_sockets(sockets: zui_node_socket_t[]): zui_node_socket_t[] {
|
||||
let r: zui_node_socket_t[] = [];
|
||||
for (let i: i32 = 0; i < sockets.length; ++i) {
|
||||
let s: zui_node_socket_t = {};
|
||||
s.id = sockets[i].id;;
|
||||
s.node_id = sockets[i].node_id;
|
||||
s.name = sockets[i].name;
|
||||
s.type = sockets[i].type;
|
||||
s.color = sockets[i].color;
|
||||
let f32a: f32_array_t = sockets[i].default_value;
|
||||
s.default_value = f32a != null ? f32_array_create_from_array(f32a) : null;
|
||||
s.min = sockets[i].min;
|
||||
s.max = sockets[i].max;
|
||||
s.precision = sockets[i].precision;
|
||||
s.display = sockets[i].display;
|
||||
array_push(r, s);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function history_clone_canvas_buttons(buttons: zui_node_button_t[]): zui_node_button_t[] {
|
||||
let r: zui_node_button_t[] = [];
|
||||
for (let i: i32 = 0; i < buttons.length; ++i) {
|
||||
let b: zui_node_button_t = {};
|
||||
b.name = buttons[i].name;
|
||||
b.type = buttons[i].type;
|
||||
b.output = buttons[i].output;
|
||||
let f32a: f32_array_t = buttons[i].default_value;
|
||||
b.default_value = f32a != null ? f32_array_create_from_array(f32a) : null;
|
||||
let u8a: u8_array_t = buttons[i].data;
|
||||
b.data = u8a != null ? u8_array_create_from_array(u8a) : null;
|
||||
b.min = buttons[i].min;
|
||||
b.max = buttons[i].max;
|
||||
b.precision = buttons[i].precision;
|
||||
b.height = buttons[i].height;
|
||||
array_push(r, b);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function history_clone_canvas_nodes(nodes: zui_node_t[]): zui_node_t[] {
|
||||
let r: zui_node_t[] = [];
|
||||
for (let i: i32 = 0; i < nodes.length; ++i) {
|
||||
let n: zui_node_t = {};
|
||||
n.id = nodes[i].id;
|
||||
n.name = nodes[i].name;
|
||||
n.type = nodes[i].type;
|
||||
n.x = nodes[i].x;
|
||||
n.y = nodes[i].y;
|
||||
n.color = nodes[i].color;
|
||||
n.inputs = history_clone_canvas_sockets(nodes[i].inputs);
|
||||
n.outputs = history_clone_canvas_sockets(nodes[i].outputs);
|
||||
n.buttons = history_clone_canvas_buttons(nodes[i].buttons);
|
||||
n.width = nodes[i].width;
|
||||
array_push(r, n);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function history_clone_canvas_links(links: zui_node_link_t[]): zui_node_link_t[] {
|
||||
let r: zui_node_link_t[] = [];
|
||||
for (let i: i32 = 0; i < links.length; ++i) {
|
||||
let l: zui_node_link_t = {};
|
||||
l.id = links[i].id;
|
||||
l.from_id = links[i].from_id;
|
||||
l.from_socket = links[i].from_socket;
|
||||
l.to_id = links[i].to_id;
|
||||
l.to_socket = links[i].to_socket;
|
||||
array_push(r, l);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function history_clone_canvas(c: zui_node_canvas_t): zui_node_canvas_t {
|
||||
let r: zui_node_canvas_t = {};
|
||||
r.name = c.name;
|
||||
r.nodes = history_clone_canvas_nodes(c.nodes);
|
||||
r.links = history_clone_canvas_links(c.links);
|
||||
return r;
|
||||
}
|
||||
|
||||
type step_t = {
|
||||
name?: string;
|
||||
canvas?: zui_node_canvas_t; // Node history
|
||||
|
||||
@@ -21,7 +21,7 @@ function plugin_create(): plugin_t {
|
||||
function plugin_start(plugin: string) {
|
||||
let blob: buffer_t = data_get_blob("plugins/" + plugin);
|
||||
_plugin_name = plugin;
|
||||
js_eval(sys_buffer_to_string(blob), plugin);
|
||||
js_eval(sys_buffer_to_string(blob));
|
||||
data_delete_blob("plugins/" + plugin);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ function tab_script_draw(htab: zui_handle_t) {
|
||||
zui_row(row);
|
||||
}
|
||||
if (zui_button(tr("Run"))) {
|
||||
js_eval(tab_script_hscript.text, "");
|
||||
js_eval(tab_script_hscript.text);
|
||||
}
|
||||
if (zui_button(tr("Clear"))) {
|
||||
tab_script_hscript.text = "";
|
||||
@@ -66,11 +66,6 @@ function tab_script_get_text_coloring(): zui_text_coloring_t {
|
||||
if (tab_script_text_coloring == null) {
|
||||
let blob: buffer_t = data_get_blob("text_coloring.json");
|
||||
tab_script_text_coloring = json_parse(sys_buffer_to_string(blob));
|
||||
tab_script_text_coloring.default_color = math_floor(tab_script_text_coloring.default_color);
|
||||
for (let i: i32 = 0; i < tab_script_text_coloring.colorings.length; ++i) {
|
||||
let coloring: zui_coloring_t = tab_script_text_coloring.colorings[i];
|
||||
coloring.color = math_floor(coloring.color);
|
||||
}
|
||||
}
|
||||
return tab_script_text_coloring;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ function ui_nodes_on_canvas_released() {
|
||||
for (let i: i32 = 0; i < canvas.nodes.length; ++i) {
|
||||
let node: zui_node_t = canvas.nodes[i];
|
||||
if (zui_input_in_rect(ui_nodes_ui._window_x + zui_nodes_NODE_X(node), ui_nodes_ui._window_y + zui_nodes_NODE_Y(node), zui_nodes_NODE_W(node), zui_nodes_NODE_H(canvas, node))) {
|
||||
if (node.id == nodes.nodes_selected_id[0]) {
|
||||
if (nodes.nodes_selected_id.length > 0 && node.id == nodes.nodes_selected_id[0]) {
|
||||
ui_view2d_hwnd.redraws = 2;
|
||||
if (time_time() - context_raw.select_time < 0.25) ui_base_show_2d_view(view_2d_type_t.NODE);
|
||||
context_raw.select_time = time_time();
|
||||
|
||||
Reference in New Issue
Block a user