Skip to content

Commit

Permalink
lab fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Oct 26, 2024
1 parent d4bca45 commit e922ef9
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 38 deletions.
3 changes: 1 addition & 2 deletions armorlab/plugins/plugins.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

#include "../../../base/sources/plugin_api.h"
#include "iron_array.h"

void texsynth_inpaint(int w, int h, void *output_ptr, void *image_ptr, void *mask_ptr, bool tiling);
#include "proc_texsynth/proc_texsynth.h"

FN(texsynth_inpaint) {
int32_t w;
Expand Down
3 changes: 3 additions & 0 deletions armorlab/plugins/proc_texsynth/proc_texsynth.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void texsynth_inpaint(int w, int h, void *output_ptr, void *image_ptr, void *mask_ptr, bool tiling);
4 changes: 2 additions & 2 deletions armorlab/sources/nodes/inpaint_node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

declare let iron_texsynth: any;
///include "../plugins/proc_texsynth/proc_texsynth.h"

type inpaint_node_t = {
base?: logic_node_t;
Expand Down Expand Up @@ -116,7 +116,7 @@ function inpaint_node_texsynth_inpaint(image: image_t, tiling: bool, mask: image
let bytes_img: buffer_t = image_get_pixels(image);
let bytes_mask: buffer_t = mask != null ? image_get_pixels(mask) : buffer_create(w * h);
let bytes_out: buffer_t = buffer_create(w * h * 4);
// texsynth_inpaint(w, h, bytes_out, bytes_img, bytes_mask, tiling);
texsynth_inpaint(w, h, bytes_out.buffer, bytes_img.buffer, bytes_mask.buffer, tiling);

inpaint_node_result = image_from_bytes(bytes_out, w, h);
return inpaint_node_result;
Expand Down
4 changes: 2 additions & 2 deletions armorlab/sources/render_path_paint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function render_path_paint_commands_cursor() {

let nodes: ui_nodes_t = ui_nodes_get_nodes();
let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true);
let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode";
let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "inpaint_node";

if (!base_ui_enabled || base_is_dragging || !inpaint) {
return;
Expand Down Expand Up @@ -302,7 +302,7 @@ function render_path_paint_bind_layers() {
let nodes: ui_nodes_t = ui_nodes_get_nodes();
let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true);
let node: ui_node_t = ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]);
let inpaint: bool = node.type == "InpaintNode";
let inpaint: bool = node.type == "inpaint_node";
if (inpaint) {
let texpaint_node_target_rt: render_target_t = map_get(render_path_render_targets, "texpaint_node_target");
texpaint_node_target_rt._image = inpaint_node_get_target();
Expand Down
8 changes: 2 additions & 6 deletions armorlab/sources/ui_nodes_ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,14 @@ function ui_nodes_ext_draw_buttons(ew: f32, start_y: f32) {
ui._x += ew + 3;
ui._y = 2 + start_y;

base_res_handle.position -= 4;

///if (arm_android || arm_ios)
let base_res_combo: string[] = ["2K", "4K"];
let base_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K"];
ui_combo(base_res_handle, base_res_combo, tr("Resolution"));
///else
let base_res_combo: string[] = ["2K", "4K", "8K", "16K"];
let base_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K", "8K", "16K"];
ui_combo(base_res_handle, base_res_combo, tr("Resolution"));
///end

base_res_handle.position += 4;

if (base_res_handle.changed) {
base_on_layers_resized();
}
Expand Down
12 changes: 0 additions & 12 deletions base/sources/box_export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,13 @@ function box_export_tab_export_textures(ui: ui_t, title: string, bake_material:
let row: f32[] = [0.5, 0.5];
ui_row(row);

///if is_paint
///if (arm_android || arm_ios)
let base_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K"];
ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true);
///else
let base_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K", "8K", "16K"];
ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true);
///end
///end

///if is_lab
///if (arm_android || arm_ios)
let base_res_combo: string[] = ["2K", "4K"];
ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true);
///else
let base_res_combo: string[] = ["2K", "4K", "8K", "16K"];
ui_combo(base_res_handle, base_res_combo, tr("Resolution"), true);
///end
///end

if (base_res_handle.changed) {
base_on_layers_resized();
Expand Down
12 changes: 0 additions & 12 deletions base/sources/box_preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,25 +425,13 @@ function box_preferences_show() {
layer_res_handle.position = config_raw.layer_res;
}

///if is_paint
///if (arm_android || arm_ios)
let layer_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K"];
ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true);
///else
let layer_res_combo: string[] = ["128", "256", "512", "1K", "2K", "4K", "8K"];
ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true);
///end
///end

///if is_lab
///if (arm_android || arm_ios)
let layer_res_combo: string[] = ["2K", "4K"];
ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true);
///else
let layer_res_combo: string[] = ["2K", "4K", "8K", "16K"];
ui_combo(layer_res_handle, layer_res_combo, tr("Default Layer Resolution"), true);
///end
///end

if (layer_res_handle.changed) {
config_raw.layer_res = layer_res_handle.position;
Expand Down
2 changes: 1 addition & 1 deletion base/sources/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ function context_run_brush(from: i32) {

let nodes: ui_nodes_t = ui_nodes_get_nodes();
let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true);
let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode";
let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "inpaint_node";

// Paint bounds
if (inpaint &&
Expand Down
2 changes: 1 addition & 1 deletion base/sources/ui_header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ function ui_header_draw_tool_properties(ui: ui_t) {

let nodes: ui_nodes_t = ui_nodes_get_nodes();
let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true);
let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "InpaintNode";
let inpaint: bool = nodes.nodes_selected_id.length > 0 && ui_get_node(canvas.nodes, nodes.nodes_selected_id[0]).type == "inpaint_node";
if (inpaint) {
context_raw.brush_radius = ui_slider(context_raw.brush_radius_handle, tr("Radius"), 0.01, 2.0, true);
if (ui.is_hovered) {
Expand Down

0 comments on commit e922ef9

Please sign in to comment.