Merge forge

This commit is contained in:
luboslenco
2025-08-07 19:43:11 +02:00
parent d1839c7027
commit 3a4aff203f
68 changed files with 266 additions and 1019 deletions
+2 -2
View File
@@ -707,7 +707,7 @@ function base_is_decal_layer(): bool {
return false;
///end
let is_painting: bool = context_raw.tool != workspace_tool_t.MATERIAL && context_raw.tool != workspace_tool_t.BAKE;
let is_painting: bool = context_raw.tool != tool_type_t.MATERIAL && context_raw.tool != tool_type_t.BAKE;
return is_painting && context_raw.layer.fill_layer != null && context_raw.layer.uv_type == uv_type_t.PROJECT;
}
@@ -824,7 +824,7 @@ function base_init_config() {
raw.dilate_radius = 2;
raw.gpu_inference = true;
raw.blender = "";
raw.atlas_res = 0;
raw.scene_atlas_res = 0;
raw.pathtrace_mode = pathtrace_mode_t.FAST;
raw.grid_snap = false;
+6 -10
View File
@@ -403,19 +403,15 @@ function box_preferences_show() {
config_raw.layer_res = layer_res_handle.position;
}
///if is_forge
let atlas_res_handle: ui_handle_t = ui_handle(__ID__);
if (atlas_res_handle.init) {
atlas_res_handle.position = config_raw.atlas_res;
let scene_atlas_res_handle: ui_handle_t = ui_handle(__ID__);
if (scene_atlas_res_handle.init) {
scene_atlas_res_handle.position = config_raw.scene_atlas_res;
}
ui_combo(atlas_res_handle, res_combo, tr("Atlas Resolution"), true);
if (atlas_res_handle.changed) {
config_raw.atlas_res = atlas_res_handle.position;
ui_combo(scene_atlas_res_handle, res_combo, tr("Scene Atlas Resolution"), true);
if (scene_atlas_res_handle.changed) {
config_raw.scene_atlas_res = scene_atlas_res_handle.position;
}
///end
let server_handle: ui_handle_t = ui_handle(__ID__);
if (server_handle.init) {
+5 -5
View File
@@ -98,7 +98,7 @@ function config_save() {
json_encode_i32("dilate_radius", config_raw.dilate_radius);
json_encode_bool("gpu_inference", config_raw.gpu_inference);
json_encode_string("blender", config_raw.blender);
json_encode_i32("atlas_res", config_raw.atlas_res);
json_encode_i32("scene_atlas_res", config_raw.scene_atlas_res);
json_encode_bool("grid_snap", config_raw.grid_snap);
let config_json: string = json_encode_end();
@@ -141,7 +141,7 @@ function config_init() {
config_raw.rp_gi = false;
config_raw.rp_vignette = 0.2;
config_raw.rp_grain = 0.09;
///if (arm_android || arm_ios || is_forge)
///if (arm_android || arm_ios)
config_raw.rp_ssao = false;
///else
config_raw.rp_ssao = true;
@@ -294,8 +294,8 @@ function config_get_layer_res(): i32 {
return config_texture_res_size(res);
}
function config_get_atlas_res(): i32 {
let res: i32 = config_raw.atlas_res;
function config_get_scene_atlas_res(): i32 {
let res: i32 = config_raw.scene_atlas_res;
return config_texture_res_size(res);
}
@@ -440,6 +440,6 @@ type config_t = {
gpu_inference?: bool;
blender?: string;
atlas_res: i32; // Forge
scene_atlas_res: i32;
grid_snap: bool;
};
+10 -10
View File
@@ -100,7 +100,7 @@ type context_t = {
layer?: slot_layer_t;
brush?: slot_brush_t;
font?: slot_font_t;
tool?: workspace_tool_t;
tool?: tool_type_t;
layer_preview_dirty?: bool;
layers_preview_dirty?: bool;
@@ -116,7 +116,7 @@ type context_t = {
material_preview?: bool;
saved_camera?: mat4_t;
color_picker_previous_tool?: workspace_tool_t;
color_picker_previous_tool?: tool_type_t;
materialid_picked?: i32;
uvx_picked?: f32;
uvy_picked?: f32;
@@ -420,7 +420,7 @@ function context_create(): context_t {
c.brush_opacity_handle = ui_handle_create();
c.brush_opacity_handle.value = 1.0;
///if is_forge
let atlas_w: i32 = config_get_atlas_res();
let atlas_w: i32 = config_get_scene_atlas_res();
let item_w: i32 = config_get_layer_res();
let atlas_stride: i32 = atlas_w / item_w;
c.brush_scale = atlas_stride;
@@ -469,7 +469,7 @@ function context_init() {
function context_use_deferred(): bool {
return context_raw.render_mode != render_mode_t.FORWARD &&
(context_raw.viewport_mode == viewport_mode_t.LIT || context_raw.viewport_mode == viewport_mode_t.PATH_TRACE) &&
context_raw.tool != workspace_tool_t.COLORID;
context_raw.tool != tool_type_t.COLORID;
}
function context_select_material(i: i32) {
@@ -576,22 +576,22 @@ function context_select_tool(i: i32) {
function context_init_tool() {
let decal: bool = context_is_decal();
if (decal) {
if (context_raw.tool == workspace_tool_t.TEXT) {
if (context_raw.tool == tool_type_t.TEXT) {
util_render_make_text_preview();
}
util_render_make_decal_preview();
}
else if (context_raw.tool == workspace_tool_t.PARTICLE) {
else if (context_raw.tool == tool_type_t.PARTICLE) {
util_particle_init();
}
else if (context_raw.tool == workspace_tool_t.BAKE) {
else if (context_raw.tool == tool_type_t.BAKE) {
// Bake in lit mode for now
if (context_raw.viewport_mode == viewport_mode_t.PATH_TRACE) {
context_raw.viewport_mode = viewport_mode_t.LIT;
}
}
else if (context_raw.tool == workspace_tool_t.MATERIAL) {
else if (context_raw.tool == tool_type_t.MATERIAL) {
layers_update_fill_layers();
context_main_object().skip_context = null;
}
@@ -687,11 +687,11 @@ function context_in_browser(): bool {
}
function context_is_picker(): bool {
return context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL;
return context_raw.tool == tool_type_t.PICKER || context_raw.tool == tool_type_t.MATERIAL;
}
function context_is_decal(): bool {
return context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT;
return context_raw.tool == tool_type_t.DECAL || context_raw.tool == tool_type_t.TEXT;
}
function context_is_decal_mask(): bool {
+1 -1
View File
@@ -237,7 +237,7 @@ enum space_type_t {
SPACE2D = 1,
}
enum workspace_tool_t {
enum tool_type_t {
BRUSH = 0,
ERASER = 1,
FILL = 2,
+2 -2
View File
@@ -116,8 +116,8 @@ function export_texture_run_bake_material(path: string) {
render_path_paint_live_layer = slot_layer_create("_live");
}
let _tool: workspace_tool_t = context_raw.tool;
context_raw.tool = workspace_tool_t.FILL;
let _tool: tool_type_t = context_raw.tool;
context_raw.tool = tool_type_t.FILL;
make_material_parse_paint_material();
let _paint_object: mesh_object_t = context_raw.paint_object;
let planeo: mesh_object_t = scene_get_child(".Plane").ext;
+2 -1
View File
@@ -5,7 +5,7 @@ let gizmo_q: quat_t = quat_create();
let gizmo_q0: quat_t = quat_create();
function gizmo_update() {
let is_object: bool = context_raw.tool == workspace_tool_t.GIZMO;
let is_object: bool = context_raw.tool == tool_type_t.GIZMO;
let is_decal: bool = base_is_decal_layer();
let gizmo: object_t = context_raw.gizmo;
@@ -16,6 +16,7 @@ function gizmo_update() {
}
let paint_object: object_t = context_raw.paint_object.base;
///if is_forge
if (context_raw.selected_object != null) {
paint_object = context_raw.selected_object;
+2 -2
View File
@@ -30,7 +30,7 @@ function import_asset_run(path: string, drop_x: f32 = -1.0, drop_y: f32 = -1.0,
if (path_is_mesh(path)) {
///if is_forge
project_import_mesh_box(path, false, false, tab_scene_import_mesh_done);
project_import_mesh_box(path, false, false, tab_meshes_import_mesh_done);
///else
show_box ? project_import_mesh_box(path) : import_mesh_run(path);
///end
@@ -56,7 +56,7 @@ function import_asset_run(path: string, drop_x: f32 = -1.0, drop_y: f32 = -1.0,
ui_nodes_hwnd.redraws = 2;
}
if (context_raw.tool == workspace_tool_t.COLORID && project_asset_names.length == 1) {
if (context_raw.tool == tool_type_t.COLORID && project_asset_names.length == 1) {
ui_header_handle.redraws = 2;
context_raw.ddirty = 2;
}
+8 -7
View File
@@ -266,7 +266,7 @@ function layers_commands_merge_pack(pipe: gpu_pipeline_t, i0: gpu_texture_t, i1:
}
function layers_is_fill_material(): bool {
if (context_raw.tool == workspace_tool_t.MATERIAL) {
if (context_raw.tool == tool_type_t.MATERIAL) {
return true;
}
@@ -282,11 +282,11 @@ function layers_is_fill_material(): bool {
function layers_update_fill_layers() {
let _layer: slot_layer_t = context_raw.layer;
let _tool: workspace_tool_t = context_raw.tool;
let _tool: tool_type_t = context_raw.tool;
let _fill_type: i32 = context_raw.fill_type_handle.position;
let current: gpu_texture_t = null;
if (context_raw.tool == workspace_tool_t.MATERIAL) {
if (context_raw.tool == tool_type_t.MATERIAL) {
if (render_path_paint_live_layer == null) {
render_path_paint_live_layer = slot_layer_create("_live");
}
@@ -294,7 +294,7 @@ function layers_update_fill_layers() {
current = _draw_current;
if (current != null) draw_end();
context_raw.tool = workspace_tool_t.FILL;
context_raw.tool = tool_type_t.FILL;
context_raw.fill_type_handle.position = fill_type_t.OBJECT;
make_material_parse_paint_material(false);
context_raw.pdirty = 1;
@@ -332,7 +332,7 @@ function layers_update_fill_layers() {
draw_end();
}
context_raw.pdirty = 1;
context_raw.tool = workspace_tool_t.FILL;
context_raw.tool = tool_type_t.FILL;
context_raw.fill_type_handle.position = fill_type_t.OBJECT;
if (has_fill_layer) {
@@ -388,9 +388,9 @@ function layers_update_fill_layer(parse_paint: bool = true) {
let in_use: bool = gpu_in_use;
if (in_use) draw_end();
let _tool: workspace_tool_t = context_raw.tool;
let _tool: tool_type_t = context_raw.tool;
let _fill_type: i32 = context_raw.fill_type_handle.position;
context_raw.tool = workspace_tool_t.FILL;
context_raw.tool = tool_type_t.FILL;
context_raw.fill_type_handle.position = fill_type_t.OBJECT;
context_raw.pdirty = 1;
@@ -513,6 +513,7 @@ function layers_create_fill_layer(uv_type: uv_type_t = uv_type_t.UVMAP, decal_ma
///if is_forge
return;
///end
_layers_uv_type = uv_type;
_layers_decal_mat = decal_mat;
_layers_position = position;
+5 -5
View File
@@ -69,9 +69,9 @@ function render_path_base_begin() {
let skip_taa: bool =
context_raw.split_view ||
context_raw.viewport_mode == viewport_mode_t.PATH_TRACE ||
((context_raw.tool == workspace_tool_t.CLONE ||
context_raw.tool == workspace_tool_t.BLUR ||
context_raw.tool == workspace_tool_t.SMUDGE) && context_raw.pdirty > 0);
((context_raw.tool == tool_type_t.CLONE ||
context_raw.tool == tool_type_t.BLUR ||
context_raw.tool == tool_type_t.SMUDGE) && context_raw.pdirty > 0);
scene_camera.frame = skip_taa ? 0 : render_path_base_taa_frame;
camera_object_proj_jitter(scene_camera);
camera_object_build_mat(scene_camera);
@@ -147,7 +147,7 @@ function render_path_base_commands(draw_commands: ()=>void) {
render_path_paint_draw();
if (context_raw.viewport_mode == viewport_mode_t.PATH_TRACE) {
let use_live_layer: bool = context_raw.tool == workspace_tool_t.MATERIAL;
let use_live_layer: bool = context_raw.tool == tool_type_t.MATERIAL;
render_path_raytrace_draw(use_live_layer);
context_raw.foreground_event = false;
render_path_base_end();
@@ -217,7 +217,7 @@ function render_path_base_draw_split(draw_commands: ()=>void) {
render_path_base_draw_gbuffer();
let use_live_layer: bool = context_raw.tool == workspace_tool_t.MATERIAL;
let use_live_layer: bool = context_raw.tool == tool_type_t.MATERIAL;
context_raw.viewport_mode == viewport_mode_t.PATH_TRACE ?
render_path_raytrace_draw(use_live_layer) :
draw_commands();
+1 -1
View File
@@ -193,7 +193,7 @@ function tab_browser_draw(htab: ui_handle_t) {
context_raw.colorid_handle.position = asset_index;
context_raw.colorid_picked = false;
ui_toolbar_handle.redraws = 1;
if (context_raw.tool == workspace_tool_t.COLORID) {
if (context_raw.tool == tool_type_t.COLORID) {
ui_header_handle.redraws = 2;
context_raw.ddirty = 2;
}
+1 -1
View File
@@ -130,7 +130,7 @@ function tab_materials_draw_slots(mini: bool) {
if (context_raw.material != project_materials[i]) {
context_select_material(i);
///if is_paint
if (context_raw.tool == workspace_tool_t.MATERIAL) {
if (context_raw.tool == tool_type_t.MATERIAL) {
sys_notify_on_init(layers_update_fill_layers);
}
///end
+1
View File
@@ -1,6 +1,7 @@
function tab_particles_draw(htab: ui_handle_t) {
if (ui_tab(htab, tr("Particles"))) {
// if (ui_tab(htab, tr("Prompt"))) {
ui_begin_sticky();
let row: f32[] = [1 / 4, 1 / 4, 1 / 4];
ui_row(row);
+1 -1
View File
@@ -146,7 +146,7 @@ function tab_swatches_draw(htab: ui_handle_t) {
context_raw.swatch.base = ui_color_wheel(h, false, -1, 11 * ui.ops.theme.ELEMENT_H * ui_SCALE(ui), true, function () {
context_raw.color_picker_previous_tool = context_raw.tool;
context_select_tool(workspace_tool_t.PICKER);
context_select_tool(tool_type_t.PICKER);
context_raw.color_picker_callback = function (color: swatch_color_t) {
let i: i32 = _tab_swatches_draw_i;
+2 -2
View File
@@ -185,7 +185,7 @@ function tab_textures_draw(htab: ui_handle_t) {
context_raw.colorid_handle.position = _tab_textures_draw_i;
context_raw.colorid_picked = false;
ui_toolbar_handle.redraws = 1;
if (context_raw.tool == workspace_tool_t.COLORID) {
if (context_raw.tool == tool_type_t.COLORID) {
ui_header_handle.redraws = 2;
context_raw.ddirty = 2;
}
@@ -269,7 +269,7 @@ function tab_textures_delete_texture(asset: asset_t) {
}
ui_base_hwnds[tab_area_t.STATUS].redraws = 2;
if (context_raw.tool == workspace_tool_t.COLORID && i == context_raw.colorid_handle.position) {
if (context_raw.tool == tool_type_t.COLORID && i == context_raw.colorid_handle.position) {
ui_header_handle.redraws = 2;
context_raw.ddirty = 2;
context_raw.colorid_picked = false;
+56 -56
View File
@@ -385,61 +385,61 @@ function ui_base_update() {
///if is_paint
if (!mouse_down("right")) { // Fly mode off
if (operator_shortcut(map_get(config_keymap, "tool_brush"))) {
context_select_tool(workspace_tool_t.BRUSH);
context_select_tool(tool_type_t.BRUSH);
}
else if (operator_shortcut(map_get(config_keymap, "tool_eraser"))) {
context_select_tool(workspace_tool_t.ERASER);
context_select_tool(tool_type_t.ERASER);
}
else if (operator_shortcut(map_get(config_keymap, "tool_fill"))) {
context_select_tool(workspace_tool_t.FILL);
context_select_tool(tool_type_t.FILL);
}
else if (operator_shortcut(map_get(config_keymap, "tool_colorid"))) {
context_select_tool(workspace_tool_t.COLORID);
context_select_tool(tool_type_t.COLORID);
}
else if (operator_shortcut(map_get(config_keymap, "tool_decal"))) {
context_select_tool(workspace_tool_t.DECAL);
context_select_tool(tool_type_t.DECAL);
}
else if (operator_shortcut(map_get(config_keymap, "tool_text"))) {
context_select_tool(workspace_tool_t.TEXT);
context_select_tool(tool_type_t.TEXT);
}
else if (operator_shortcut(map_get(config_keymap, "tool_clone"))) {
context_select_tool(workspace_tool_t.CLONE);
context_select_tool(tool_type_t.CLONE);
}
else if (operator_shortcut(map_get(config_keymap, "tool_blur"))) {
context_select_tool(workspace_tool_t.BLUR);
context_select_tool(tool_type_t.BLUR);
}
else if (operator_shortcut(map_get(config_keymap, "tool_smudge"))) {
context_select_tool(workspace_tool_t.SMUDGE);
context_select_tool(tool_type_t.SMUDGE);
}
else if (operator_shortcut(map_get(config_keymap, "tool_particle"))) {
context_select_tool(workspace_tool_t.PARTICLE);
context_select_tool(tool_type_t.PARTICLE);
}
else if (operator_shortcut(map_get(config_keymap, "tool_picker"))) {
context_select_tool(workspace_tool_t.PICKER);
context_select_tool(tool_type_t.PICKER);
}
else if (operator_shortcut(map_get(config_keymap, "tool_bake"))) {
context_select_tool(workspace_tool_t.BAKE);
context_select_tool(tool_type_t.BAKE);
}
else if (operator_shortcut(map_get(config_keymap, "tool_gizmo"))) {
context_select_tool(workspace_tool_t.GIZMO);
context_select_tool(tool_type_t.GIZMO);
}
else if (operator_shortcut(map_get(config_keymap, "tool_material"))) {
context_select_tool(workspace_tool_t.MATERIAL);
context_select_tool(tool_type_t.MATERIAL);
}
else if (operator_shortcut(map_get(config_keymap, "swap_brush_eraser"))) {
context_select_tool(context_raw.tool == workspace_tool_t.BRUSH ? workspace_tool_t.ERASER : workspace_tool_t.BRUSH);
context_select_tool(context_raw.tool == tool_type_t.BRUSH ? tool_type_t.ERASER : tool_type_t.BRUSH);
}
}
// Radius
if (context_raw.tool == workspace_tool_t.BRUSH ||
context_raw.tool == workspace_tool_t.ERASER ||
context_raw.tool == workspace_tool_t.DECAL ||
context_raw.tool == workspace_tool_t.TEXT ||
context_raw.tool == workspace_tool_t.CLONE ||
context_raw.tool == workspace_tool_t.BLUR ||
context_raw.tool == workspace_tool_t.SMUDGE ||
context_raw.tool == workspace_tool_t.PARTICLE) {
if (context_raw.tool == tool_type_t.BRUSH ||
context_raw.tool == tool_type_t.ERASER ||
context_raw.tool == tool_type_t.DECAL ||
context_raw.tool == tool_type_t.TEXT ||
context_raw.tool == tool_type_t.CLONE ||
context_raw.tool == tool_type_t.BLUR ||
context_raw.tool == tool_type_t.SMUDGE ||
context_raw.tool == tool_type_t.PARTICLE) {
if (operator_shortcut(map_get(config_keymap, "brush_radius")) ||
operator_shortcut(map_get(config_keymap, "brush_opacity")) ||
operator_shortcut(map_get(config_keymap, "brush_angle")) ||
@@ -487,10 +487,10 @@ function ui_base_update() {
///if is_lab
if (ui_header_worktab.position == space_type_t.SPACE3D) {
// Radius
if (context_raw.tool == workspace_tool_t.ERASER ||
context_raw.tool == workspace_tool_t.CLONE ||
context_raw.tool == workspace_tool_t.BLUR ||
context_raw.tool == workspace_tool_t.SMUDGE) {
if (context_raw.tool == tool_type_t.ERASER ||
context_raw.tool == tool_type_t.CLONE ||
context_raw.tool == tool_type_t.BLUR ||
context_raw.tool == tool_type_t.SMUDGE) {
if (operator_shortcut(map_get(config_keymap, "brush_radius"))) {
context_raw.brush_can_lock = true;
if (!pen_connected) {
@@ -706,7 +706,7 @@ function ui_base_update() {
}
///if arm_physics
if (context_raw.tool == workspace_tool_t.PARTICLE && context_in_paint_area() && !context_raw.paint2d) {
if (context_raw.tool == tool_type_t.PARTICLE && context_in_paint_area() && !context_raw.paint2d) {
util_particle_init_physics();
let world: physics_world_t = physics_world_active;
physics_world_update(world);
@@ -955,7 +955,7 @@ function ui_base_update_ui() {
context_raw.brush_stencil_y += (old_h - new_h) / base_h() / 2;
}
let set_clone_source: bool = context_raw.tool == workspace_tool_t.CLONE && operator_shortcut(map_get(config_keymap, "set_clone_source") + "+" + map_get(config_keymap, "action_paint"), shortcut_type_t.DOWN);
let set_clone_source: bool = context_raw.tool == tool_type_t.CLONE && operator_shortcut(map_get(config_keymap, "set_clone_source") + "+" + map_get(config_keymap, "action_paint"), shortcut_type_t.DOWN);
let decal: bool = context_is_decal();
let decal_mask: bool = context_is_decal_mask_paint();
@@ -984,7 +984,7 @@ function ui_base_update_ui() {
}
///if arm_physics
if (context_raw.tool == workspace_tool_t.PARTICLE) {
if (context_raw.tool == tool_type_t.PARTICLE) {
down = false;
}
///end
@@ -1032,12 +1032,12 @@ function ui_base_update_ui() {
history_push_undo = true;
if (context_raw.tool == workspace_tool_t.CLONE && context_raw.clone_start_x >= 0.0) { // Clone delta
if (context_raw.tool == tool_type_t.CLONE && context_raw.clone_start_x >= 0.0) { // Clone delta
context_raw.clone_delta_x = (context_raw.clone_start_x - mx) / ww;
context_raw.clone_delta_y = (context_raw.clone_start_y - my) / sys_h();
context_raw.clone_start_x = -1;
}
else if (context_raw.tool == workspace_tool_t.FILL && context_raw.fill_type_handle.position == fill_type_t.UV_ISLAND) {
else if (context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.UV_ISLAND) {
util_uv_uvislandmap_cached = false;
}
}
@@ -1062,7 +1062,7 @@ function ui_base_update_ui() {
context_raw.layer_preview_dirty = true; // Update layer preview
// New color id picked, update fill layer
if (context_raw.tool == workspace_tool_t.COLORID && context_raw.layer.fill_layer != null) {
if (context_raw.tool == tool_type_t.COLORID && context_raw.layer.fill_layer != null) {
sys_notify_on_next_frame(function () {
layers_update_fill_layer();
make_material_parse_paint_material(false);
@@ -1275,7 +1275,7 @@ function ui_base_render_cursor() {
return;
}
if (context_raw.tool == workspace_tool_t.MATERIAL || context_raw.tool == workspace_tool_t.BAKE) {
if (context_raw.tool == tool_type_t.MATERIAL || context_raw.tool == tool_type_t.BAKE) {
return;
}
@@ -1294,10 +1294,10 @@ function ui_base_render_cursor() {
}
if (context_raw.brush_stencil_image != null &&
context_raw.tool != workspace_tool_t.BAKE &&
context_raw.tool != workspace_tool_t.PICKER &&
context_raw.tool != workspace_tool_t.MATERIAL &&
context_raw.tool != workspace_tool_t.COLORID) {
context_raw.tool != tool_type_t.BAKE &&
context_raw.tool != tool_type_t.PICKER &&
context_raw.tool != tool_type_t.MATERIAL &&
context_raw.tool != tool_type_t.COLORID) {
let r: rect_t = ui_base_get_brush_stencil_rect();
if (!operator_shortcut(map_get(config_keymap, "stencil_hide"), shortcut_type_t.DOWN)) {
draw_set_color(0x88ffffff);
@@ -1330,13 +1330,13 @@ function ui_base_render_cursor() {
}
// Show picked material next to cursor
if (context_raw.tool == workspace_tool_t.PICKER && context_raw.picker_select_material && context_raw.color_picker_callback == null) {
if (context_raw.tool == tool_type_t.PICKER && context_raw.picker_select_material && context_raw.color_picker_callback == null) {
let img: gpu_texture_t = context_raw.material.image_icon;
draw_image(img, mx + 10, my + 10);
}
if (context_raw.tool == workspace_tool_t.PICKER && context_raw.color_picker_callback != null) {
if (context_raw.tool == tool_type_t.PICKER && context_raw.color_picker_callback != null) {
let img: gpu_texture_t = resource_get("icons.k");
let rect: rect_t = resource_tile50(img, workspace_tool_t.PICKER, 0);
let rect: rect_t = resource_tile50(img, tool_type_t.PICKER, 0);
draw_sub_image(img, mx + 10, my + 10, rect.x, rect.y, rect.w, rect.h);
}
@@ -1344,7 +1344,7 @@ function ui_base_render_cursor() {
let psize: i32 = math_floor(182 * (context_raw.brush_radius * context_raw.brush_nodes_radius) * ui_SCALE(ui_base_ui));
// Clone source cursor
if (context_raw.tool == workspace_tool_t.CLONE && !keyboard_down("alt") && (mouse_down() || pen_down())) {
if (context_raw.tool == tool_type_t.CLONE && !keyboard_down("alt") && (mouse_down() || pen_down())) {
draw_set_color(0x66ffffff);
draw_scaled_image(cursor_img, mx + context_raw.clone_delta_x * sys_w() - psize / 2, my + context_raw.clone_delta_y * sys_h() - psize / 2, psize, psize);
draw_set_color(0xffffffff);
@@ -1385,12 +1385,12 @@ function ui_base_render_cursor() {
draw_set_color(0xffffffff);
}
}
if (context_raw.tool == workspace_tool_t.BRUSH ||
context_raw.tool == workspace_tool_t.ERASER ||
context_raw.tool == workspace_tool_t.CLONE ||
context_raw.tool == workspace_tool_t.BLUR ||
context_raw.tool == workspace_tool_t.SMUDGE ||
context_raw.tool == workspace_tool_t.PARTICLE ||
if (context_raw.tool == tool_type_t.BRUSH ||
context_raw.tool == tool_type_t.ERASER ||
context_raw.tool == tool_type_t.CLONE ||
context_raw.tool == tool_type_t.BLUR ||
context_raw.tool == tool_type_t.SMUDGE ||
context_raw.tool == tool_type_t.PARTICLE ||
(decal_mask && !config_raw.brush_3d) ||
(decal_mask && context_in_2d_view())) {
if (decal_mask) {
@@ -1404,14 +1404,14 @@ function ui_base_render_cursor() {
}
if (context_raw.brush_lazy_radius > 0 && !context_raw.brush_locked &&
(context_raw.tool == workspace_tool_t.BRUSH ||
context_raw.tool == workspace_tool_t.ERASER ||
context_raw.tool == workspace_tool_t.DECAL ||
context_raw.tool == workspace_tool_t.TEXT ||
context_raw.tool == workspace_tool_t.CLONE ||
context_raw.tool == workspace_tool_t.BLUR ||
context_raw.tool == workspace_tool_t.SMUDGE ||
context_raw.tool == workspace_tool_t.PARTICLE)) {
(context_raw.tool == tool_type_t.BRUSH ||
context_raw.tool == tool_type_t.ERASER ||
context_raw.tool == tool_type_t.DECAL ||
context_raw.tool == tool_type_t.TEXT ||
context_raw.tool == tool_type_t.CLONE ||
context_raw.tool == tool_type_t.BLUR ||
context_raw.tool == tool_type_t.SMUDGE ||
context_raw.tool == tool_type_t.PARTICLE)) {
draw_filled_rect(mx - 1, my - 1, 2, 2);
mx = context_raw.brush_lazy_x * base_w() + base_x();
my = context_raw.brush_lazy_y * base_h() + base_y();
+5 -1
View File
@@ -972,7 +972,7 @@ function ui_nodes_render() {
if (nodes.color_picker_callback != null) {
context_raw.color_picker_previous_tool = context_raw.tool;
context_select_tool(workspace_tool_t.PICKER);
context_select_tool(tool_type_t.PICKER);
_ui_nodes_render_tmp = nodes.color_picker_callback;
context_raw.color_picker_callback = function (color: swatch_color_t) {
@@ -1183,6 +1183,10 @@ function ui_nodes_render() {
}
///end
// let type_combo: string[] = [tr("Shader"), tr("Neural")];
// let type_handle: ui_handle_t = ui_handle(__ID__);
// let type: i32 = ui_combo(type_handle, type_combo, tr("Type"), true);
///if is_lab
ui_nodes_ui.window_border_top = 0;
ui_nodes_ext_draw_buttons(ew, start_y);
+1 -1
View File
@@ -54,7 +54,7 @@ function ui_toolbar_draw_tool(i: i32, ui: ui_t, img: gpu_texture_t, icon_accent:
}
///if is_paint
if (i == workspace_tool_t.COLORID && context_raw.colorid_picked) {
if (i == tool_type_t.COLORID && context_raw.colorid_picked) {
let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid");
draw_scaled_sub_image(rt._image, 0, 0, 1, 1, 0, _y + 1.5 * ui_SCALE(ui), 5 * ui_SCALE(ui), 34 * ui_SCALE(ui));
}
+4 -4
View File
@@ -250,7 +250,7 @@ function ui_view2d_render() {
}
// Texture and node preview color picking
if ((context_in_2d_view(view_2d_type_t.ASSET) || context_in_2d_view(view_2d_type_t.NODE)) && context_raw.tool == workspace_tool_t.PICKER && ui_view2d_ui.input_down) {
if ((context_in_2d_view(view_2d_type_t.ASSET) || context_in_2d_view(view_2d_type_t.NODE)) && context_raw.tool == tool_type_t.PICKER && ui_view2d_ui.input_down) {
_ui_view2d_render_tex = tex;
_ui_view2d_render_x = ui_view2d_ui.input_x - tx - ui_view2d_wx;;
_ui_view2d_render_y = ui_view2d_ui.input_y - ty - ui_view2d_wy;
@@ -410,7 +410,7 @@ function ui_view2d_render() {
// Picked position
///if is_paint
if (context_raw.tool == workspace_tool_t.PICKER && (ui_view2d_type == view_2d_type_t.LAYER || ui_view2d_type == view_2d_type_t.ASSET)) {
if (context_raw.tool == tool_type_t.PICKER && (ui_view2d_type == view_2d_type_t.LAYER || ui_view2d_type == view_2d_type_t.ASSET)) {
let cursor_img: gpu_texture_t = resource_get("cursor.k");
let hsize: f32 = 16 * ui_SCALE(ui_view2d_ui);
let size: f32 = hsize * 2;
@@ -468,9 +468,9 @@ function ui_view2d_update() {
///if is_paint
let decal_mask: bool = context_is_decal_mask_paint();
let set_clone_source: bool = context_raw.tool == workspace_tool_t.CLONE &&
let set_clone_source: bool = context_raw.tool == tool_type_t.CLONE &&
operator_shortcut(map_get(config_keymap, "set_clone_source") + "+" + map_get(config_keymap, "action_paint"), shortcut_type_t.DOWN);
let bake: bool = context_raw.tool == workspace_tool_t.BAKE;
let bake: bool = context_raw.tool == tool_type_t.BAKE;
if (ui_view2d_type == view_2d_type_t.LAYER &&
!ui_view2d_text_input_hover &&
+1 -1
View File
@@ -80,7 +80,7 @@ function uniforms_ext_f32_link(object: object_t, mat: material_data_t, link: str
}
else if (link == "_brush_hardness") {
let decal_mask: bool = context_is_decal_mask_paint();
if (context_raw.tool != workspace_tool_t.BRUSH && context_raw.tool != workspace_tool_t.ERASER && context_raw.tool != workspace_tool_t.CLONE && !decal_mask) {
if (context_raw.tool != tool_type_t.BRUSH && context_raw.tool != tool_type_t.ERASER && context_raw.tool != tool_type_t.CLONE && !decal_mask) {
return 1.0;
}
let val: f32 = context_raw.brush_hardness * context_raw.brush_nodes_hardness;
+4 -4
View File
@@ -228,8 +228,8 @@ function util_render_make_brush_preview() {
context_raw.material.nodes.pan_y = context_raw.brush.nodes.pan_y;
context_raw.material.nodes.zoom = context_raw.brush.nodes.zoom;
let _tool: workspace_tool_t = context_raw.tool;
context_raw.tool = workspace_tool_t.BRUSH;
let _tool: tool_type_t = context_raw.tool;
context_raw.tool = tool_type_t.BRUSH;
let _layer: slot_layer_t = context_raw.layer;
if (slot_layer_is_mask(context_raw.layer)) {
@@ -413,8 +413,8 @@ function util_render_make_node_preview(canvas: ui_node_canvas_t, node: ui_node_t
function util_render_pick_pos_nor_tex() {
context_raw.pick_pos_nor_tex = true;
context_raw.pdirty = 1;
let _tool: workspace_tool_t = context_raw.tool;
context_raw.tool = workspace_tool_t.PICKER;
let _tool: tool_type_t = context_raw.tool;
context_raw.tool = tool_type_t.PICKER;
make_material_parse_paint_material();
if (context_raw.paint2d) {
render_path_paint_set_plane_mesh();