diff --git a/base/sources/ts/base.ts b/base/sources/ts/base.ts index ebe1712e..0549c57a 100644 --- a/base/sources/ts/base.ts +++ b/base/sources/ts/base.ts @@ -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; diff --git a/base/sources/ts/box_preferences.ts b/base/sources/ts/box_preferences.ts index a8c3fbc6..b10998cd 100644 --- a/base/sources/ts/box_preferences.ts +++ b/base/sources/ts/box_preferences.ts @@ -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) { diff --git a/base/sources/ts/config.ts b/base/sources/ts/config.ts index ee283ac3..d4c485f2 100644 --- a/base/sources/ts/config.ts +++ b/base/sources/ts/config.ts @@ -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; }; diff --git a/base/sources/ts/context.ts b/base/sources/ts/context.ts index 62243dcb..55273636 100644 --- a/base/sources/ts/context.ts +++ b/base/sources/ts/context.ts @@ -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 { diff --git a/base/sources/ts/enums.ts b/base/sources/ts/enums.ts index e6a89721..40b356bc 100644 --- a/base/sources/ts/enums.ts +++ b/base/sources/ts/enums.ts @@ -237,7 +237,7 @@ enum space_type_t { SPACE2D = 1, } -enum workspace_tool_t { +enum tool_type_t { BRUSH = 0, ERASER = 1, FILL = 2, diff --git a/base/sources/ts/export_texture.ts b/base/sources/ts/export_texture.ts index 2a14f4c5..2c2005c4 100644 --- a/base/sources/ts/export_texture.ts +++ b/base/sources/ts/export_texture.ts @@ -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; diff --git a/base/sources/ts/gizmo.ts b/base/sources/ts/gizmo.ts index 2003ae8f..f2845001 100644 --- a/base/sources/ts/gizmo.ts +++ b/base/sources/ts/gizmo.ts @@ -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; diff --git a/base/sources/ts/import_asset.ts b/base/sources/ts/import_asset.ts index 2a6eab93..ca204d85 100644 --- a/base/sources/ts/import_asset.ts +++ b/base/sources/ts/import_asset.ts @@ -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; } diff --git a/base/sources/ts/layers.ts b/base/sources/ts/layers.ts index 5608a550..5929fb45 100644 --- a/base/sources/ts/layers.ts +++ b/base/sources/ts/layers.ts @@ -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; diff --git a/base/sources/ts/render_path_base.ts b/base/sources/ts/render_path_base.ts index 14846329..5230c61f 100644 --- a/base/sources/ts/render_path_base.ts +++ b/base/sources/ts/render_path_base.ts @@ -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(); diff --git a/base/sources/ts/tab_browser.ts b/base/sources/ts/tab_browser.ts index 0ff9e6f9..bd9d7836 100644 --- a/base/sources/ts/tab_browser.ts +++ b/base/sources/ts/tab_browser.ts @@ -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; } diff --git a/base/sources/ts/tab_materials.ts b/base/sources/ts/tab_materials.ts index 8b214b7c..fb3367d0 100644 --- a/base/sources/ts/tab_materials.ts +++ b/base/sources/ts/tab_materials.ts @@ -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 diff --git a/base/sources/ts/tab_particles.ts b/base/sources/ts/tab_particles.ts index 9f88178a..40a637c3 100644 --- a/base/sources/ts/tab_particles.ts +++ b/base/sources/ts/tab_particles.ts @@ -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); diff --git a/base/sources/ts/tab_swatches.ts b/base/sources/ts/tab_swatches.ts index 4098d451..4ff9ddd5 100644 --- a/base/sources/ts/tab_swatches.ts +++ b/base/sources/ts/tab_swatches.ts @@ -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; diff --git a/base/sources/ts/tab_textures.ts b/base/sources/ts/tab_textures.ts index 19dc02b1..1c4f307c 100644 --- a/base/sources/ts/tab_textures.ts +++ b/base/sources/ts/tab_textures.ts @@ -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; diff --git a/base/sources/ts/ui_base.ts b/base/sources/ts/ui_base.ts index cad2b74b..a4d9d881 100644 --- a/base/sources/ts/ui_base.ts +++ b/base/sources/ts/ui_base.ts @@ -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(); diff --git a/base/sources/ts/ui_nodes.ts b/base/sources/ts/ui_nodes.ts index d99399b5..671bd691 100644 --- a/base/sources/ts/ui_nodes.ts +++ b/base/sources/ts/ui_nodes.ts @@ -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); diff --git a/base/sources/ts/ui_toolbar.ts b/base/sources/ts/ui_toolbar.ts index d033f281..df96f3b9 100644 --- a/base/sources/ts/ui_toolbar.ts +++ b/base/sources/ts/ui_toolbar.ts @@ -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)); } diff --git a/base/sources/ts/ui_view2d.ts b/base/sources/ts/ui_view2d.ts index a6a3b6c2..ff8ab06b 100644 --- a/base/sources/ts/ui_view2d.ts +++ b/base/sources/ts/ui_view2d.ts @@ -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 && diff --git a/base/sources/ts/uniforms_ext.ts b/base/sources/ts/uniforms_ext.ts index 610c9ddd..8746fcb6 100644 --- a/base/sources/ts/uniforms_ext.ts +++ b/base/sources/ts/uniforms_ext.ts @@ -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; diff --git a/base/sources/ts/util_render.ts b/base/sources/ts/util_render.ts index 83d3b579..7416d6de 100644 --- a/base/sources/ts/util_render.ts +++ b/base/sources/ts/util_render.ts @@ -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(); diff --git a/forge/assets/badge.png b/forge/assets/badge.png deleted file mode 100644 index 8da0c5a3..00000000 Binary files a/forge/assets/badge.png and /dev/null differ diff --git a/forge/assets/default_brush.arm b/forge/assets/default_brush.arm deleted file mode 100644 index e8671ac4..00000000 Binary files a/forge/assets/default_brush.arm and /dev/null differ diff --git a/forge/assets/default_material.arm b/forge/assets/default_material.arm deleted file mode 100644 index e2a96817..00000000 Binary files a/forge/assets/default_material.arm and /dev/null differ diff --git a/forge/assets/licenses/keepme.txt b/forge/assets/licenses/keepme.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/forge/assets/meshes/sphere.arm b/forge/assets/meshes/sphere.arm deleted file mode 100644 index 8d4d48a6..00000000 Binary files a/forge/assets/meshes/sphere.arm and /dev/null differ diff --git a/forge/assets/meshes/torus.arm b/forge/assets/meshes/torus.arm deleted file mode 100644 index 44b27dad..00000000 Binary files a/forge/assets/meshes/torus.arm and /dev/null differ diff --git a/forge/assets/plugins/keepme.txt b/forge/assets/plugins/keepme.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/forge/assets/readme/readme.txt b/forge/assets/readme/readme.txt deleted file mode 100644 index 2ced04cf..00000000 --- a/forge/assets/readme/readme.txt +++ /dev/null @@ -1,14 +0,0 @@ -Thank you for supporting ArmorForge! - -Quick start: -https://armory3d.org/forge/manual - - ( - ( )\ ) - )\ ( ) ( (()/( ( ( ( ( -((((_)( )( ( ( )( /(_)) ( )( )\))( ))\ - )\ _ )\(()\ )\ ' )\ (()\ (_))_| )\ (()\ ((_))\ /((_) - (_)_\(_)((_) _((_)) ((_) ((_)| |_ ((_) ((_) (()(_)(_)) - / _ \ | '_|| ' \()/ _ \| '_|| __|/ _ \| '_|/ _` | / -_) - /_/ \_\|_| |_|_|_| \___/|_| |_| \___/|_| \__, | \___| - |___/ diff --git a/forge/icon.png b/forge/icon.png deleted file mode 100644 index f9ad2c5e..00000000 Binary files a/forge/icon.png and /dev/null differ diff --git a/forge/plugins/plugins.c b/forge/plugins/plugins.c deleted file mode 100644 index e7e86a13..00000000 --- a/forge/plugins/plugins.c +++ /dev/null @@ -1,8 +0,0 @@ - -#include "../../../base/plugins/plugin_api.h" - -// void plugin_embed() { -// JSValue global_obj = JS_GetGlobalObject(js_ctx); - -// JS_FreeValue(js_ctx, global_obj); -// } diff --git a/forge/plugins/project.js b/forge/plugins/project.js deleted file mode 100644 index 2bf4c71c..00000000 --- a/forge/plugins/project.js +++ /dev/null @@ -1,5 +0,0 @@ -let project = new Project("plugins"); - -project.add_cfiles("plugins.c"); - -return project; diff --git a/forge/project.js b/forge/project.js deleted file mode 100644 index 0e9f14f8..00000000 --- a/forge/project.js +++ /dev/null @@ -1,32 +0,0 @@ - -let flags = globalThis.flags; -flags.name = "ArmorForge"; -flags.package = "org.armorforge"; -flags.with_video_write = true; - -let project = new Project(flags.name); -project.add_define("is_forge"); -project.add_define("is_paint"); -project.add_project("../base"); - -project.add_tsfiles("../paint/sources"); -project.add_tsfiles("../paint/sources/nodes"); -project.add_shaders("../paint/shaders/*.kong"); -project.add_project("../paint/plugins"); - -project.add_tsfiles("sources"); -project.add_tsfiles("sources/nodes"); -project.add_shaders("shaders/*.kong"); -project.add_assets("assets/*", { destination: "data/{name}" }); -project.add_assets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); -project.add_assets("assets/licenses/**", { destination: "data/licenses/{name}" }); -project.add_assets("assets/plugins/*", { destination: "data/plugins/{name}" }); -project.add_assets("../paint/assets/plugins/hello_world.js", { destination: "data/plugins/{name}" }); -project.add_assets("../paint/assets/plugins/import_fbx.js", { destination: "data/plugins/{name}" }); -project.add_assets("../paint/assets/plugins/import_gltf_glb.js", { destination: "data/plugins/{name}" }); -project.add_assets("../paint/assets/plugins/uv_unwrap.js", { destination: "data/plugins/{name}" }); -project.add_assets("assets/meshes/*", { destination: "data/meshes/{name}", noembed: true }); -project.add_assets("assets/readme/readme.txt", { destination: "{name}" }); - -project.flatten(); -return project; diff --git a/forge/readme.md b/forge/readme.md deleted file mode 100644 index 79867f44..00000000 --- a/forge/readme.md +++ /dev/null @@ -1,6 +0,0 @@ -![](https://armory3d.org/forge/img/git.jpg) - -armorforge -============== - -Utility for managing scene objects. Please disregard for now. diff --git a/forge/shaders/keepme.txt b/forge/shaders/keepme.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/forge/sources/base_ext.ts b/forge/sources/base_ext.ts deleted file mode 100644 index 5ec55b5c..00000000 --- a/forge/sources/base_ext.ts +++ /dev/null @@ -1,35 +0,0 @@ - -function base_ext_init() { - sim_init(); - - transform_move(project_paint_objects[0].base.transform, vec4_z_axis(), -999); // Move default cube away - tab_scene_new_object("box.arm"); -} - -function base_ext_render() { - if (context_raw.frame == 2) { - util_render_make_material_preview(); - ui_base_hwnds[tab_area_t.SIDEBAR1].redraws = 2; - - base_init_undo_layers(); - } - - sim_update(); -} - -function base_ext_init_config(raw: config_t) { - raw.window_w = 1920; - raw.window_h = 1080; - raw.atlas_res = texture_res_t.RES8192; - raw.undo_steps = 1; -} - -function base_ext_update() { - if (keyboard_down("control") && keyboard_started("d")) { - sim_duplicate(); - } - - if (keyboard_started("delete")) { - sim_delete(); - } -} diff --git a/forge/sources/context_ext.ts b/forge/sources/context_ext.ts deleted file mode 100644 index 930422b0..00000000 --- a/forge/sources/context_ext.ts +++ /dev/null @@ -1,14 +0,0 @@ - -function context_ext_init(c: context_t) { - c.tool = workspace_tool_t.GIZMO; - c.brush_radius = 1.0; -} - -function context_ext_select_paint_object(o: mesh_object_t) { - for (let i: i32 = 0; i < project_paint_objects.length; ++i) { - let p: mesh_object_t = project_paint_objects[i]; - p.skip_context = "paint"; - } - context_raw.paint_object.skip_context = ""; - context_raw.paint_object = o; -} diff --git a/forge/sources/manifest.ts b/forge/sources/manifest.ts deleted file mode 100644 index 4faf6db7..00000000 --- a/forge/sources/manifest.ts +++ /dev/null @@ -1,6 +0,0 @@ - -let manifest_title: string = "ArmorForge"; -let manifest_version: string = "0.1"; -let manifest_url: string = "https://armory3d.org/forge"; -let manifest_url_android: string = ""; -let manifest_url_ios: string = ""; diff --git a/forge/sources/sim.ts b/forge/sources/sim.ts deleted file mode 100644 index a47d59a5..00000000 --- a/forge/sources/sim.ts +++ /dev/null @@ -1,126 +0,0 @@ - -let sim_running: bool = false; -let sim_transforms: mat4_box_t[]; -let sim_object_script_map: map_t = map_create(); -let sim_record: bool = false; - -function sim_init() { - physics_world_create(); -} - -function sim_update() { - - render_path_raytrace_ready = false; - - if (sim_running) { - // if (render_path_raytrace_frame != 1) { - // return; - // } - - let objects: object_t[] = map_keys(sim_object_script_map); - for (let i: i32 = 0; i < objects.length; ++i) { - let o: object_t = objects[i]; - let s: string = map_get(sim_object_script_map, o); - let addr: string = i64_to_string((i64)(o.transform)); - s = "{let transform=" + addr + ";" + s + "}"; - js_eval(s); - } - - let world: physics_world_t = physics_world_active; - physics_world_update(world); - - iron_delay_idle_sleep(); - - if (sim_record) { - let rt: render_target_t = map_get(render_path_render_targets, "last"); - let pixels: buffer_t = gpu_get_texture_pixels(rt._image); - ///if (arm_metal || arm_vulkan) - export_arm_bgra_swap(pixels); - ///end - iron_mp4_encode(pixels); - } - } -} - -function sim_play() { - sim_running = true; - - if (sim_record) { - if (project_filepath == "") { - console_error(tr("Save project first")); - sim_record = false; - return; - } - let path: string = path_base_dir(project_filepath) + "/output.mp4"; - let rt: render_target_t = map_get(render_path_render_targets, "last"); - iron_mp4_begin(path, rt._image.width, rt._image.height); - } - - // Save transforms - sim_transforms = []; - let pos: mesh_object_t[] = project_paint_objects; - for (let i: i32 = 0; i < pos.length; ++i) { - let m: mat4_box_t = { v: pos[i].base.transform.local }; - array_push(sim_transforms, m); - } -} - -function sim_stop() { - sim_running = false; - - if (sim_record) { - iron_mp4_end(); - } - - // Restore transforms - let pos: mesh_object_t[] = project_paint_objects; - for (let i: i32 = 0; i < pos.length; ++i) { - transform_set_matrix(pos[i].base.transform, sim_transforms[i].v); - - let pb: physics_body_t = map_get(physics_body_object_map, pos[i].base.uid); - if (pb != null) { - physics_body_sync_transform(pb); - } - } -} - -function sim_add_body(o: object_t, shape: physics_shape_t, mass: f32) { - let body: physics_body_t = physics_body_create(); - body.shape = shape; - body.mass = mass; - physics_body_init(body, o); -} - -function sim_remove_body(uid: i32) { - physics_body_remove(uid); -} - -function sim_duplicate() { - // Mesh - let so: mesh_object_t = context_raw.selected_object.ext; - let dup: mesh_object_t = scene_add_mesh_object(so.data, so.materials, so.base.parent); - transform_set_matrix(dup.base.transform, so.base.transform.local); - array_push(project_paint_objects, dup); - dup.base.name = so.base.name; - - // Physics - let pb: physics_body_t = map_get(physics_body_object_map, so.base.uid); - if (pb != null) { - let pbdup: physics_body_t = physics_body_create(); - pbdup.shape = pb.shape; - pbdup.mass = pb.mass; - physics_body_init(pbdup, dup.base); - } - - _tab_scene_paint_object_length++; - tab_scene_sort(); -} - -function sim_delete() { - let so: mesh_object_t = context_raw.selected_object.ext; - array_remove(project_paint_objects, so); - mesh_object_remove(so); - sim_remove_body(so.base.uid); - _tab_scene_paint_object_length--; - tab_scene_sort(); -} diff --git a/forge/sources/tab_object.ts b/forge/sources/tab_object.ts deleted file mode 100644 index db573b29..00000000 --- a/forge/sources/tab_object.ts +++ /dev/null @@ -1,197 +0,0 @@ - -function tab_object_draw(htab: ui_handle_t) { - let ui: ui_t = ui_base_ui; - if (ui_tab(htab, tr("Object"))) { - - if (context_raw.selected_object != null) { - let h: ui_handle_t = ui_handle(__ID__); - h.selected = context_raw.selected_object.visible; - context_raw.selected_object.visible = ui_check(h, "Visible"); - - if (h.changed) { - // Rebuild full vb for path-tracing - util_mesh_merge(); - } - - let t: transform_t = context_raw.selected_object.transform; - let rot: vec4_t = quat_get_euler(t.rot); - rot = vec4_mult(rot, 180 / 3.141592); - let f: f32 = 0.0; - let changed: bool = false; - - ui_text("Transform", ui_align_t.LEFT, ui.ops.theme.SEPARATOR_COL); - - ui_row4(); - ui_text("Loc"); - - h = ui_handle(__ID__); - h.text = f32_to_string(t.loc.x); - f = parse_float(ui_text_input(h, "X")); - if (h.changed) { - changed = true; - t.loc.x = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(t.loc.y); - f = parse_float(ui_text_input(h, "Y")); - if (h.changed) { - changed = true; - t.loc.y = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(t.loc.z); - f = parse_float(ui_text_input(h, "Z")); - if (h.changed) { - changed = true; - t.loc.z = f; - } - - ui_row4(); - ui_text("Rotation"); - - h = ui_handle(__ID__); - h.text = f32_to_string(rot.x); - f = parse_float(ui_text_input(h, "X")); - if (h.changed) { - changed = true; - rot.x = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(rot.y); - f = parse_float(ui_text_input(h, "Y")); - if (h.changed) { - changed = true; - rot.y = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(rot.z); - f = parse_float(ui_text_input(h, "Z")); - if (h.changed) { - changed = true; - rot.z = f; - } - - ui_row4(); - ui_text("Scale"); - - h = ui_handle(__ID__); - h.text = f32_to_string(t.scale.x); - f = parse_float(ui_text_input(h, "X")); - if (h.changed) { - changed = true; - t.scale.x = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(t.scale.y); - f = parse_float(ui_text_input(h, "Y")); - if (h.changed) { - changed = true; - t.scale.y = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(t.scale.z); - f = parse_float(ui_text_input(h, "Z")); - if (h.changed) { - changed = true; - t.scale.z = f; - } - - ui_row4(); - ui_text("Dimensions"); - - h = ui_handle(__ID__); - h.text = f32_to_string(t.dim.x); - f = parse_float(ui_text_input(h, "X")); - if (h.changed) { - changed = true; - t.dim.x = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(t.dim.y); - f = parse_float(ui_text_input(h, "Y")); - if (h.changed) { - changed = true; - t.dim.y = f; - } - - h = ui_handle(__ID__); - h.text = f32_to_string(t.dim.z); - f = parse_float(ui_text_input(h, "Z")); - if (h.changed) { - changed = true; - t.dim.z = f; - } - - if (changed) { - rot = vec4_mult(rot, 3.141592 / 180); - context_raw.selected_object.transform.rot = quat_from_euler(rot.x, rot.y, rot.z); - transform_build_matrix(context_raw.selected_object.transform); - transform_compute_dim(context_raw.selected_object.transform); - ///if arm_physics - let pb: physics_body_t = map_get(physics_body_object_map, context_raw.selected_object.uid); - if (pb != null) { - physics_body_sync_transform(pb); - } - ///end - } - - ui_text("Physics", ui_align_t.LEFT, ui.ops.theme.SEPARATOR_COL); - - let pb: physics_body_t = map_get(physics_body_object_map, context_raw.selected_object.uid); - - let hshape: ui_handle_t = ui_handle(__ID__); - let shape_combo: string[] = [ - tr("None"), - tr("Box"), - tr("Sphere"), - tr("Convex Hull"), - tr("Terrain"), - tr("Mesh"), - ]; - hshape.position = pb != null ? pb.shape + 1 : 0; - ui_combo(hshape, shape_combo, tr("Shape"), true); - - let hdynamic: ui_handle_t = ui_handle(__ID__); - hdynamic.selected = pb != null ? pb.mass > 0 : false; - ui_check(hdynamic, "Dynamic"); - - if (hshape.changed || hdynamic.changed) { - sim_remove_body(context_raw.selected_object.uid); - if (hshape.position > 0) { - sim_add_body(context_raw.selected_object, hshape.position - 1, hdynamic.selected ? 1.0 : 0.0); - } - } - - ui_text("Script", ui_align_t.LEFT, ui.ops.theme.SEPARATOR_COL); - - let script: string = map_get(sim_object_script_map, context_raw.selected_object); - if (script == null) { - script = ""; - } - - let hscript: ui_handle_t = ui_handle(__ID__); - hscript.text = script; - - let _font: draw_font_t = ui.ops.font; - let _font_size: i32 = ui.font_size; - let fmono: draw_font_t = data_get_font("font_mono.ttf"); - ui_set_font(ui, fmono); - ui.font_size = math_floor(15 * ui_SCALE(ui)); - ui_text_area_coloring = tab_script_get_text_coloring(); - ui_text_area(hscript); - ui_text_area_coloring = null; - ui_set_font(ui, _font); - ui.font_size = _font_size; - - script = hscript.text; - map_set(sim_object_script_map, context_raw.selected_object, script); - } - } -} diff --git a/forge/sources/tab_scene.ts b/forge/sources/tab_scene.ts deleted file mode 100644 index 197c235a..00000000 --- a/forge/sources/tab_scene.ts +++ /dev/null @@ -1,207 +0,0 @@ - -let tab_scene_line_counter: i32 = 0; -let tab_scene_new_meshes: string[] = null; -let _tab_scene_paint_object_length: i32 = 1; - -function tab_scene_select_object(mo: mesh_object_t) { - if (mo == null) { - return; - } - - context_raw.selected_object = mo.base; - - if (mo.base.ext_type != "mesh_object_t") { - return; - } - - context_raw.paint_object = mo; - if (context_raw.merged_object != null) { - context_raw.merged_object.base.visible = false; - } - context_select_paint_object(mo); -} - -function tab_scene_sort() { - let scene: object_t = _scene_root.children[0]; - array_sort(scene.children, function (pa: any_ptr, pb: any_ptr): i32 { - let a: object_t = DEREFERENCE(pa); - let b: object_t = DEREFERENCE(pb); - return strcmp(a.name, b.name); - }); -} - -function tab_scene_import_mesh_done() { - let count: i32 = project_paint_objects.length - _tab_scene_paint_object_length; - _tab_scene_paint_object_length = project_paint_objects.length; - - for (let i: i32 = 0; i < count; ++i) { - let mo: mesh_object_t = project_paint_objects[project_paint_objects.length - 1 - i]; - object_set_parent(mo.base, null); - tab_scene_select_object(mo); - } - - sys_notify_on_next_frame(function() { - util_mesh_merge(); - tab_scene_select_object(context_raw.selected_object.ext); - tab_scene_sort(); - }); -} - -function tab_scene_draw_list(ui: ui_t, list_handle: ui_handle_t, current_object: object_t) { - if (char_at(current_object.name, 0) == ".") { - return; // Hidden - } - - let b: bool = false; - - // Highlight every other line - if (tab_scene_line_counter % 2 == 0) { - draw_set_color(ui.ops.theme.SEPARATOR_COL); - draw_filled_rect(0, ui._y, ui._window_w, ui_ELEMENT_H(ui)); - draw_set_color(0xffffffff); - } - - // Highlight selected line - if (current_object == context_raw.selected_object) { - draw_set_color(0xff205d9c); - draw_filled_rect(0, ui._y, ui._window_w, ui_ELEMENT_H(ui)); - draw_set_color(0xffffffff); - } - - if (current_object.children.length > 0) { - let row: f32[] = [1 / 13, 12 / 13]; - ui_row(row); - let h: ui_handle_t = ui_nest(list_handle, tab_scene_line_counter); - if (h.init) { - h.selected = true; - } - b = ui_panel(h, "", true, false); - ui_text(current_object.name); - } - else { - ui._x += 18; // Sign offset - - // Draw line that shows parent relations - draw_set_color(ui.ops.theme.BUTTON_COL); - draw_line(ui._x - 10, ui._y + ui_ELEMENT_H(ui) / 2, ui._x, ui._y + ui_ELEMENT_H(ui) / 2); - draw_set_color(0xffffffff); - - ui_text(current_object.name); - ui._x -= 18; - } - - tab_scene_line_counter++; - // Undo applied offset for row drawing caused by end_element() - ui._y -= ui_ELEMENT_OFFSET(ui); - - if (ui.is_released) { - tab_scene_select_object(current_object.ext); - } - - if (ui.is_hovered && ui.input_released_r) { - tab_scene_select_object(current_object.ext); - - ui_menu_draw(function (ui: ui_t) { - if (ui_menu_button(tr("Duplicate"))) { - sim_duplicate(); - } - if (ui_menu_button(tr("Delete"))) { - sim_delete(); - } - }); - } - - if (b) { - let current_y: i32 = ui._y; - for (let i: i32 = 0; i < current_object.children.length; ++i) { - let child: object_t = current_object.children[i]; - ui._x += 8; - tab_scene_draw_list(ui, list_handle, child); - ui._x -= 8; - } - - // Draw line that shows parent relations - draw_set_color(ui.ops.theme.BUTTON_COL); - draw_line(ui._x + 14, current_y, ui._x + 14, ui._y - ui_ELEMENT_H(ui) / 2); - draw_set_color(0xffffffff); - } -} - -function tab_scene_new_object(mesh_name: string) { - let blob: buffer_t = iron_load_blob(data_path() + "meshes/" + mesh_name); - let raw: scene_t = armpack_decode(blob); - util_mesh_ext_pack_uvs(raw.mesh_datas[0].vertex_arrays[2].values); - let md: mesh_data_t = mesh_data_create(raw.mesh_datas[0]); - md._.handle = md.name; - let mo: mesh_object_t = scene_add_mesh_object(md, project_paint_objects[0].materials); - mo.base.name = md.name; - let o: obj_t = {}; - o._ = { _gc: raw }; - mo.base.raw = o; - map_set(data_cached_meshes, md._.handle, md); - array_push(project_paint_objects, mo); - tab_scene_import_mesh_done(); - sys_notify_on_next_frame(function(mo: mesh_object_t) { - tab_scene_select_object(mo); - }, mo); -} - -function tab_scene_new_menu(ui: ui_t) { - for (let i: i32 = 0; i < tab_scene_new_meshes.length; ++i) { - let mesh_name: string = tab_scene_new_meshes[i]; - if (ui_menu_button(mesh_name)) { - tab_scene_new_object(mesh_name); - } - } -} - -function tab_scene_draw(htab: ui_handle_t) { - let ui: ui_t = ui_base_ui; - if (ui_tab(htab, tr("Scene"))) { - - ui_begin_sticky(); - - let row: f32[] = [1 / 4, 1 / 4]; - ui_row(row); - - if (ui_button("New")) { - if (tab_scene_new_meshes == null) { - tab_scene_new_meshes = file_read_directory(path_data() + path_sep + "meshes"); - } - - ui_menu_draw(tab_scene_new_menu); - } - - if (ui_button("Import")) { - project_import_mesh(false, tab_scene_import_mesh_done); - } - - ui_end_sticky(); - - { - ui._y -= ui_ELEMENT_OFFSET(ui); - - tab_scene_line_counter = 0; - - let scene: object_t = _scene_root.children[0]; - for (let i: i32 = 0; i < scene.children.length; ++i) { - let c: object_t = scene.children[i]; - tab_scene_draw_list(ui, ui_handle(__ID__), c); - } - - // Select object with arrow keys - if (ui.is_key_pressed && ui.key_code == key_code_t.DOWN) { - let i: i32 = array_index_of(project_paint_objects, context_raw.selected_object.ext); - if (i < project_paint_objects.length - 1) { - tab_scene_select_object(project_paint_objects[i + 1]); - } - } - if (ui.is_key_pressed && ui.key_code == key_code_t.UP) { - let i: i32 = array_index_of(project_paint_objects, context_raw.selected_object.ext); - if (i > 1) { - tab_scene_select_object(project_paint_objects[i - 1]); - } - } - } - } -} diff --git a/forge/sources/ui_base_ext.ts b/forge/sources/ui_base_ext.ts deleted file mode 100644 index 28a23a8c..00000000 --- a/forge/sources/ui_base_ext.ts +++ /dev/null @@ -1,30 +0,0 @@ - -function ui_base_ext_init_hwnd_tabs(): tab_draw_array_t[] { - - let a0: tab_draw_array_t = [ - _draw_callback_create(tab_scene_draw), - _draw_callback_create(tab_history_draw), - _draw_callback_create(tab_plugins_draw) - ]; - let a1: tab_draw_array_t = [ - _draw_callback_create(tab_object_draw), - _draw_callback_create(tab_materials_draw), - _draw_callback_create(tab_particles_draw) - ]; - let a2: tab_draw_array_t = [ - _draw_callback_create(tab_browser_draw), - _draw_callback_create(tab_textures_draw), - _draw_callback_create(tab_meshes_draw), - _draw_callback_create(tab_fonts_draw), - _draw_callback_create(tab_swatches_draw), - _draw_callback_create(tab_script_draw), - _draw_callback_create(tab_console_draw), - _draw_callback_create(ui_status_draw_version_tab) - ]; - - let r: tab_draw_array_t[] = []; - array_push(r, a0); - array_push(r, a1); - array_push(r, a2); - return r; -} diff --git a/forge/sources/ui_header_ext.ts b/forge/sources/ui_header_ext.ts deleted file mode 100644 index 1c0d3eb5..00000000 --- a/forge/sources/ui_header_ext.ts +++ /dev/null @@ -1,25 +0,0 @@ - -function ui_header_draw_tool_properties(ui: ui_t) { - if (context_raw.tool == workspace_tool_t.GIZMO) { - - if (!sim_running && ui_button("Play")) { - sim_play(); - context_raw.selected_object = scene_camera.base; - } - - if (sim_running && ui_button("Stop")) { - sim_stop(); - } - - let h_record: ui_handle_t = ui_handle(__ID__); - sim_record = ui_check(h_record, tr("Record")); - } - - else if (context_raw.tool == workspace_tool_t.FILL) { - let brush_scale_handle: ui_handle_t = ui_handle(__ID__); - if (brush_scale_handle.init) { - brush_scale_handle.value = context_raw.brush_scale; - } - context_raw.brush_scale = ui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); - } -} diff --git a/forge/sources/ui_toolbar_ext.ts b/forge/sources/ui_toolbar_ext.ts deleted file mode 100644 index 3b65b67f..00000000 --- a/forge/sources/ui_toolbar_ext.ts +++ /dev/null @@ -1,10 +0,0 @@ - -function ui_toolbar_ext_draw_tools(ui: ui_t, img: gpu_texture_t, icon_accent: i32, keys: string[]) { - - ui_toolbar_draw_tool(workspace_tool_t.GIZMO, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.BRUSH, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.ERASER, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.FILL, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.PARTICLE, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.PICKER, ui, img, icon_accent, keys); -} diff --git a/forge/sources/util_mesh_ext.ts b/forge/sources/util_mesh_ext.ts deleted file mode 100644 index a5a08a6b..00000000 --- a/forge/sources/util_mesh_ext.ts +++ /dev/null @@ -1,41 +0,0 @@ - -function _util_mesh_unique_data_count(): i32 { - return util_mesh_ext_get_unique().length; -} - -function util_mesh_ext_pack_uvs(texa: i16_array_t) { - // Scale tex coords into global atlas - let atlas_w: i32 = config_get_atlas_res(); - let item_i: i32 = _util_mesh_unique_data_count() - 1; // Add the one being imported - let item_w: i32 = config_get_layer_res(); - let atlas_stride: i32 = atlas_w / item_w; - let atlas_step: i32 = 32767 / atlas_stride; - let item_x: i32 = (item_i % atlas_stride) * atlas_step; - let item_y: i32 = math_floor(item_i / atlas_stride) * atlas_step; - for (let i: i32 = 0; i < texa.length / 2; ++i) { - texa[i * 2] = texa[i * 2] / atlas_stride + item_x; - texa[i * 2 + 1] = texa[i * 2 + 1] / atlas_stride + item_y; - } -} - -function util_mesh_ext_get_unique(): mesh_object_t[] { - let ar: mesh_object_t[] = []; - - for (let i: i32 = 0; i < project_paint_objects.length; ++i) { - if (!project_paint_objects[i].base.visible) { - continue; - } - let found: bool = false; - for (let j: i32 = 0; j < i; ++j) { - if (project_paint_objects[i].data == project_paint_objects[j].data) { - found = true; - break; - } - } - if (!found) { - array_push(ar, project_paint_objects[i]); - } - } - - return ar; -} diff --git a/lab/sources/context_ext.ts b/lab/sources/context_ext.ts index 5d778e41..e3e12545 100644 --- a/lab/sources/context_ext.ts +++ b/lab/sources/context_ext.ts @@ -1,7 +1,7 @@ function context_ext_init(c: context_t) { - c.tool = workspace_tool_t.ERASER; - c.color_picker_previous_tool = workspace_tool_t.ERASER; + c.tool = tool_type_t.ERASER; + c.color_picker_previous_tool = tool_type_t.ERASER; c.brush_radius = 0.25; c.brush_radius_handle.value = 0.25; c.brush_hardness = 0.8; diff --git a/lab/sources/make_paint.ts b/lab/sources/make_paint.ts index 2b8c5ba1..0e10e202 100644 --- a/lab/sources/make_paint.ts +++ b/lab/sources/make_paint.ts @@ -1,6 +1,6 @@ function make_paint_color_attachments(): string[] { - if (context_raw.tool == workspace_tool_t.PICKER) { + if (context_raw.tool == tool_type_t.PICKER) { let res: string[] = ["RGBA32", "RGBA32", "RGBA32", "RGBA32"]; return res; } @@ -40,7 +40,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad let kong: node_shader_t = node_shader_context_make_kong(con_paint); - if (context_raw.tool == workspace_tool_t.PICKER) { + if (context_raw.tool == tool_type_t.PICKER) { // Mangle vertices to form full screen triangle node_shader_write_vert(kong, "output.pos = float4(-1.0 + float((vertex_id() & 1) << 2), -1.0 + float((vertex_id() & 2) << 1), 0.0, 1.0);"); @@ -93,10 +93,10 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_add_constant(kong, "brush_opacity: float", "_brush_opacity"); node_shader_add_constant(kong, "brush_hardness: float", "_brush_hardness"); - 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) { node_shader_write_frag(kong, "var dist: float = 0.0;"); @@ -124,14 +124,14 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_write_frag(kong, "if (dist > constants.brush_radius) { discard; }"); } - if (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.CLONE || context_raw.tool == tool_type_t.BLUR || context_raw.tool == tool_type_t.SMUDGE) { node_shader_add_texture(kong, "gbuffer2"); node_shader_add_constant(kong, "gbuffer_size: float2", "_gbuffer_size"); node_shader_add_texture(kong, "texpaint_undo", "_texpaint_undo"); node_shader_add_texture(kong, "texpaint_nor_undo", "_texpaint_nor_undo"); node_shader_add_texture(kong, "texpaint_pack_undo", "_texpaint_pack_undo"); - if (context_raw.tool == workspace_tool_t.CLONE) { + if (context_raw.tool == tool_type_t.CLONE) { } else { // Blur } @@ -153,7 +153,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_add_texture(kong, "texpaint_undo", "_texpaint_undo"); node_shader_write_frag(kong, "var sample_undo: float4 = sample_lod(texpaint_undo, sampler_linear, sample_tc, 0.0);"); - if (context_raw.tool == workspace_tool_t.ERASER) { + if (context_raw.tool == tool_type_t.ERASER) { node_shader_write_frag(kong, "output[0] = float4(0.0, 0.0, 0.0, 0.0);"); node_shader_write_frag(kong, "output[1] = float4(0.5, 0.5, 1.0, 0.0);"); node_shader_write_frag(kong, "output[2] = float4(1.0, 0.0, 0.0, 0.0);"); diff --git a/lab/sources/render_path_paint.ts b/lab/sources/render_path_paint.ts index 89f9b37b..ac74c1e4 100644 --- a/lab/sources/render_path_paint.ts +++ b/lab/sources/render_path_paint.ts @@ -62,7 +62,7 @@ function render_path_paint_commands_paint(dilation: bool = true) { if (context_raw.pdirty > 0) { - if (context_raw.tool == workspace_tool_t.PICKER) { + if (context_raw.tool == tool_type_t.PICKER) { let additional: string[] = ["texpaint_nor_picker", "texpaint_pack_picker", "texpaint_uv_picker"]; render_path_set_target("texpaint_picker", additional); render_path_bind_target("gbuffer2", "gbuffer2"); @@ -132,9 +132,9 @@ function render_path_paint_commands_paint(dilation: bool = true) { render_path_bind_target("texpaint_blend1", "paintmask"); // Read texcoords from gbuffer - let read_tc: bool = context_raw.tool == workspace_tool_t.CLONE || - context_raw.tool == workspace_tool_t.BLUR || - context_raw.tool == workspace_tool_t.SMUDGE; + let read_tc: bool = context_raw.tool == tool_type_t.CLONE || + context_raw.tool == tool_type_t.BLUR || + context_raw.tool == tool_type_t.SMUDGE; if (read_tc) { render_path_bind_target("gbuffer2", "gbuffer2"); } @@ -145,11 +145,11 @@ function render_path_paint_commands_paint(dilation: bool = true) { } function render_path_paint_commands_cursor() { - let tool: workspace_tool_t = context_raw.tool; - if (tool != workspace_tool_t.ERASER && - tool != workspace_tool_t.CLONE && - tool != workspace_tool_t.BLUR && - tool != workspace_tool_t.SMUDGE) { + let tool: tool_type_t = context_raw.tool; + if (tool != tool_type_t.ERASER && + tool != tool_type_t.CLONE && + tool != tool_type_t.BLUR && + tool != tool_type_t.SMUDGE) { return; } diff --git a/lab/sources/ui_base_ext.ts b/lab/sources/ui_base_ext.ts index 300b959c..6f0a70b3 100644 --- a/lab/sources/ui_base_ext.ts +++ b/lab/sources/ui_base_ext.ts @@ -5,8 +5,8 @@ function ui_base_ext_init_hwnd_tabs(): tab_draw_array_t[] { let a1: tab_draw_array_t = []; let a2: tab_draw_array_t = [ _draw_callback_create(tab_browser_draw), - _draw_callback_create(tab_textures_draw), _draw_callback_create(tab_meshes_draw), + _draw_callback_create(tab_textures_draw), _draw_callback_create(tab_swatches_draw), _draw_callback_create(tab_plugins_draw), _draw_callback_create(tab_script_draw), diff --git a/lab/sources/ui_header_ext.ts b/lab/sources/ui_header_ext.ts index a4810140..2bc97236 100644 --- a/lab/sources/ui_header_ext.ts +++ b/lab/sources/ui_header_ext.ts @@ -1,12 +1,12 @@ function ui_header_draw_tool_properties(ui: ui_t) { - if (context_raw.tool == workspace_tool_t.PICKER) { + if (context_raw.tool == tool_type_t.PICKER) { } - else 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) { + else 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) { let nodes: ui_nodes_t = ui_nodes_get_nodes(); let canvas: ui_node_canvas_t = ui_nodes_get_canvas(true); diff --git a/forge/assets/meshes/box.arm b/paint/assets/meshes/box.arm similarity index 100% rename from forge/assets/meshes/box.arm rename to paint/assets/meshes/box.arm diff --git a/forge/assets/meshes/box_bevel.arm b/paint/assets/meshes/box_bevel.arm similarity index 100% rename from forge/assets/meshes/box_bevel.arm rename to paint/assets/meshes/box_bevel.arm diff --git a/forge/assets/meshes/cone.arm b/paint/assets/meshes/cone.arm similarity index 100% rename from forge/assets/meshes/cone.arm rename to paint/assets/meshes/cone.arm diff --git a/forge/assets/meshes/cylinder.arm b/paint/assets/meshes/cylinder.arm similarity index 100% rename from forge/assets/meshes/cylinder.arm rename to paint/assets/meshes/cylinder.arm diff --git a/paint/assets/meshes/torus.arm b/paint/assets/meshes/torus.arm new file mode 100644 index 00000000..f2d3573a Binary files /dev/null and b/paint/assets/meshes/torus.arm differ diff --git a/paint/sources/context_ext.ts b/paint/sources/context_ext.ts index 3c66eaf1..532b8859 100644 --- a/paint/sources/context_ext.ts +++ b/paint/sources/context_ext.ts @@ -1,7 +1,7 @@ function context_ext_init(c: context_t) { - c.tool = workspace_tool_t.BRUSH; - c.color_picker_previous_tool = workspace_tool_t.BRUSH; + c.tool = tool_type_t.BRUSH; + c.color_picker_previous_tool = tool_type_t.BRUSH; c.brush_radius = 0.5; c.brush_radius_handle.value = 0.5; c.brush_hardness = 0.8; diff --git a/paint/sources/make_blur.ts b/paint/sources/make_blur.ts index 67b86772..0e1c4127 100644 --- a/paint/sources/make_blur.ts +++ b/paint/sources/make_blur.ts @@ -27,7 +27,7 @@ function make_blur_run(kong: node_shader_t) { node_shader_add_constant(kong, "texpaint_size: float2", "_texpaint_size"); node_shader_write_frag(kong, "var blur_step: float = 1.0 / constants.texpaint_size.x;"); - if (context_raw.tool == workspace_tool_t.SMUDGE) { + if (context_raw.tool == tool_type_t.SMUDGE) { // node_shader_write_frag(kong, "const blur_weight: float[7] = {1.0 / 28.0, 2.0 / 28.0, 3.0 / 28.0, 4.0 / 28.0, 5.0 / 28.0, 6.0 / 28.0, 7.0 / 28.0};"); node_shader_add_function(kong, str_get_smudge_tool_weight); node_shader_add_constant(kong, "brush_direction: float3", "_brush_direction"); diff --git a/paint/sources/make_brush.ts b/paint/sources/make_brush.ts index 9371212e..bc0b7490 100644 --- a/paint/sources/make_brush.ts +++ b/paint/sources/make_brush.ts @@ -3,7 +3,7 @@ function make_brush_run(kong: node_shader_t) { node_shader_write_frag(kong, "var dist: float = 0.0;"); - if (context_raw.tool == workspace_tool_t.PARTICLE) { + if (context_raw.tool == tool_type_t.PARTICLE) { return; } diff --git a/paint/sources/make_colorid_picker.ts b/paint/sources/make_colorid_picker.ts index 3a87277b..65549e69 100644 --- a/paint/sources/make_colorid_picker.ts +++ b/paint/sources/make_colorid_picker.ts @@ -11,13 +11,13 @@ function make_colorid_picker_run(kong: node_shader_t) { node_shader_write_frag(kong, "var tex_coord_inp4: float4 = gbuffer2[uint2(uint(constants.inp.x * constants.gbuffer_size.x), uint(constants.inp.y * constants.gbuffer_size.y))];"); node_shader_write_frag(kong, "var tex_coord_inp: float2 = tex_coord_inp4.ba;"); - if (context_raw.tool == workspace_tool_t.COLORID) { + if (context_raw.tool == tool_type_t.COLORID) { kong.frag_out = "float4"; node_shader_add_texture(kong, "texcolorid", "_texcolorid"); node_shader_write_frag(kong, "var idcol: float3 = sample_lod(texcolorid, sampler_linear, tex_coord_inp, 0.0).rgb;"); node_shader_write_frag(kong, "output = float4(idcol, 1.0);"); } - else if (context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL) { + else if (context_raw.tool == tool_type_t.PICKER || context_raw.tool == tool_type_t.MATERIAL) { if (context_raw.pick_pos_nor_tex) { kong.frag_out = "float4[2]"; node_shader_add_texture(kong, "gbufferD"); diff --git a/paint/sources/make_material.ts b/paint/sources/make_material.ts index 48383c37..23ce7c4a 100644 --- a/paint/sources/make_material.ts +++ b/paint/sources/make_material.ts @@ -317,10 +317,10 @@ function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_ } let _space: i32 = ui_header_worktab.position; - let _tool: workspace_tool_t = context_raw.tool; + let _tool: tool_type_t = context_raw.tool; let _bake_type: bake_type_t = context_raw.bake_type; ui_header_worktab.position = space_type_t.SPACE3D; - context_raw.tool = workspace_tool_t.BAKE; + context_raw.tool = tool_type_t.BAKE; context_raw.bake_type = bake_type_t.CURVATURE; parser_material_bake_passthrough = true; diff --git a/paint/sources/make_mesh.ts b/paint/sources/make_mesh.ts index 96df0fe6..2fce4bfe 100644 --- a/paint/sources/make_mesh.ts +++ b/paint/sources/make_mesh.ts @@ -80,7 +80,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte kong.frag_n = true; node_shader_add_function(kong, str_pack_float_int16); - if (context_raw.tool == workspace_tool_t.COLORID) { + if (context_raw.tool == tool_type_t.COLORID) { texture_count++; node_shader_add_texture(kong, "texcolorid", "_texcolorid"); node_shader_write_frag(kong, "output[0] = float4(n.xy, 1.0, pack_f32_i16(0.0, uint(0)));"); @@ -162,7 +162,7 @@ function make_mesh_run(data: material_t, layer_pass: i32 = 0): node_shader_conte make_mesh_layer_pass_count = 1; let layers: slot_layer_t[] = []; let start_count: i32 = texture_count; - let is_material_tool: bool = context_raw.tool == workspace_tool_t.MATERIAL; + let is_material_tool: bool = context_raw.tool == tool_type_t.MATERIAL; for (let i: i32 = 0; i < project_layers.length; ++i) { let l: slot_layer_t = project_layers[i]; if (is_material_tool && l != context_raw.layer) { diff --git a/paint/sources/make_mesh_preview.ts b/paint/sources/make_mesh_preview.ts index 1fd85059..9b410c46 100644 --- a/paint/sources/make_mesh_preview.ts +++ b/paint/sources/make_mesh_preview.ts @@ -85,7 +85,7 @@ function make_mesh_preview_run(data: material_t, matcon: material_context_t): no node_shader_write_frag(kong, "var height: float = " + height + ";"); if (decal) { - if (context_raw.tool == workspace_tool_t.TEXT) { + if (context_raw.tool == tool_type_t.TEXT) { node_shader_add_texture(kong, "textexttool", "_textexttool"); node_shader_write_frag(kong, "opacity *= sample_lod(textexttool, sampler_linear, tex_coord / float(" + brush_scale + "), 0.0).r;"); } diff --git a/paint/sources/make_paint.ts b/paint/sources/make_paint.ts index a6049261..67d6a33b 100644 --- a/paint/sources/make_paint.ts +++ b/paint/sources/make_paint.ts @@ -1,24 +1,24 @@ -///if (is_paint || is_forge) +///if is_paint function make_paint_is_raytraced_bake(): bool { return context_raw.bake_type == bake_type_t.INIT; } function make_paint_color_attachments(): string[] { - if (context_raw.tool == workspace_tool_t.COLORID) { + if (context_raw.tool == tool_type_t.COLORID) { let res: string[] = ["RGBA32"]; return res; } - if (context_raw.tool == workspace_tool_t.PICKER && context_raw.pick_pos_nor_tex) { + if (context_raw.tool == tool_type_t.PICKER && context_raw.pick_pos_nor_tex) { let res: string[] = ["RGBA128", "RGBA128"]; return res; } - if (context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL) { + if (context_raw.tool == tool_type_t.PICKER || context_raw.tool == tool_type_t.MATERIAL) { let res: string[] = ["RGBA32", "RGBA32", "RGBA32", "RGBA32"]; return res; } - if (context_raw.tool == workspace_tool_t.BAKE && make_paint_is_raytraced_bake()) { + if (context_raw.tool == tool_type_t.BAKE && make_paint_is_raytraced_bake()) { let res: string[] = ["RGBA64", "RGBA64"]; return res; } @@ -74,7 +74,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad let kong: node_shader_t = node_shader_context_make_kong(con_paint); - if (context_raw.tool == workspace_tool_t.BAKE && context_raw.bake_type == bake_type_t.INIT) { + if (context_raw.tool == tool_type_t.BAKE && context_raw.bake_type == bake_type_t.INIT) { // Init raytraced bake make_bake_position_normal(kong); con_paint.data.shader_from_source = true; @@ -82,19 +82,19 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad return con_paint; } - if (context_raw.tool == workspace_tool_t.BAKE) { + if (context_raw.tool == tool_type_t.BAKE) { make_bake_set_color_writes(con_paint); } - if (context_raw.tool == workspace_tool_t.COLORID || context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL) { + if (context_raw.tool == tool_type_t.COLORID || context_raw.tool == tool_type_t.PICKER || context_raw.tool == tool_type_t.MATERIAL) { make_colorid_picker_run(kong); con_paint.data.shader_from_source = true; gpu_create_shaders_from_kong(node_shader_get(kong), ADDRESS(con_paint.data.vertex_shader), ADDRESS(con_paint.data.fragment_shader), ADDRESS(con_paint.data._.vertex_shader_size), ADDRESS(con_paint.data._.fragment_shader_size)); return con_paint; } - let face_fill: bool = context_raw.tool == workspace_tool_t.FILL && context_raw.fill_type_handle.position == fill_type_t.FACE; - let uv_island_fill: bool = context_raw.tool == workspace_tool_t.FILL && context_raw.fill_type_handle.position == fill_type_t.UV_ISLAND; + let face_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.FACE; + let uv_island_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.UV_ISLAND; let decal: bool = context_is_decal(); node_shader_write_vert(kong, "var tpos: float2 = float2(input.tex.x * 2.0 - 1.0, (1.0 - input.tex.y) * 2.0 - 1.0);"); @@ -136,12 +136,12 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_add_constant(kong, "brush_opacity: float", "_brush_opacity"); node_shader_add_constant(kong, "brush_hardness: float", "_brush_hardness"); - 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) { let depth_reject: bool = !context_raw.xray; @@ -150,7 +150,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } // TODO: sp.z needs to take height channel into account - let particle: bool = context_raw.tool == workspace_tool_t.PARTICLE; + let particle: bool = context_raw.tool == tool_type_t.PARTICLE; if (config_raw.brush_3d && !decal && !particle) { if (make_material_height_used || context_raw.sym_x || context_raw.sym_y || context_raw.sym_z) { depth_reject = false; @@ -165,7 +165,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } else { // Fill, Bake node_shader_write_frag(kong, "var dist: float = 0.0;"); - let angle_fill: bool = context_raw.tool == workspace_tool_t.FILL && context_raw.fill_type_handle.position == fill_type_t.ANGLE; + let angle_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.ANGLE; if (angle_fill) { node_shader_add_function(kong, str_octahedron_wrap); node_shader_add_texture(kong, "gbuffer0"); @@ -179,7 +179,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad let angle: f32 = context_raw.brush_angle_reject_dot; node_shader_write_frag(kong, "if (dot(wn, n) < " + angle + ") { discard; }"); } - let stencil_fill: bool = context_raw.tool == workspace_tool_t.FILL && context_raw.brush_stencil_image != null; + let stencil_fill: bool = context_raw.tool == tool_type_t.FILL && context_raw.brush_stencil_image != null; if (stencil_fill) { node_shader_write_frag(kong, "if (sp.z > sample_lod(gbufferD, sampler_linear, sp.xy, 0.0).r - 0.00005) { discard; }"); } @@ -205,14 +205,14 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad make_texcoord_run(kong); - if (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.CLONE || context_raw.tool == tool_type_t.BLUR || context_raw.tool == tool_type_t.SMUDGE) { node_shader_add_texture(kong, "gbuffer2"); node_shader_add_constant(kong, "gbuffer_size: float2", "_gbuffer_size"); node_shader_add_texture(kong, "texpaint_undo", "_texpaint_undo"); node_shader_add_texture(kong, "texpaint_nor_undo", "_texpaint_nor_undo"); node_shader_add_texture(kong, "texpaint_pack_undo", "_texpaint_pack_undo"); - if (context_raw.tool == workspace_tool_t.CLONE) { + if (context_raw.tool == tool_type_t.CLONE) { make_clone_run(kong); } else { // Blur, Smudge @@ -272,7 +272,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad make_material_subs_used = parse_float(subs) != 0.0; } - if (context_raw.brush_mask_image != null && context_raw.tool == workspace_tool_t.DECAL) { + if (context_raw.brush_mask_image != null && context_raw.tool == tool_type_t.DECAL) { node_shader_add_texture(kong, "texbrushmask", "_texbrushmask"); node_shader_write_frag(kong, "var mask_sample: float4 = sample_lod(texbrushmask, sampler_linear, uvsp, 0.0);"); if (context_raw.brush_mask_image_is_alpha) { @@ -282,19 +282,19 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_write_frag(kong, "opacity *= mask_sample.r * mask_sample.a;"); } } - else if (context_raw.tool == workspace_tool_t.TEXT) { + else if (context_raw.tool == tool_type_t.TEXT) { node_shader_add_texture(kong, "textexttool", "_textexttool"); node_shader_write_frag(kong, "opacity *= sample_lod(textexttool, sampler_linear, uvsp, 0.0).r;"); } if (context_raw.brush_stencil_image != null && ( - context_raw.tool == workspace_tool_t.BRUSH || - context_raw.tool == workspace_tool_t.ERASER || - context_raw.tool == workspace_tool_t.FILL || - 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.FILL || + 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)) { node_shader_add_texture(kong, "texbrushstencil", "_texbrushstencil"); node_shader_add_constant(kong, "texbrushstencil_size: float2", "_size(_texbrushstencil)"); @@ -317,7 +317,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } } - if (context_raw.brush_mask_image != null && (context_raw.tool == workspace_tool_t.BRUSH || context_raw.tool == workspace_tool_t.ERASER)) { + if (context_raw.brush_mask_image != null && (context_raw.tool == tool_type_t.BRUSH || context_raw.tool == tool_type_t.ERASER)) { node_shader_add_texture(kong, "texbrushmask", "_texbrushmask"); node_shader_write_frag(kong, "var binp_mask: float2 = constants.inp.xy * 2.0 - 1.0;"); node_shader_write_frag(kong, "binp_mask.x *= constants.aspect_ratio;"); @@ -350,7 +350,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_write_frag(kong, "if (opacity == 0.0) { discard; }"); - if (context_raw.tool == workspace_tool_t.PARTICLE) { // Particle mask + if (context_raw.tool == tool_type_t.PARTICLE) { // Particle mask make_particle_mask(kong); } else { // Brush cursor mask @@ -395,7 +395,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad let is_mask: bool = slot_layer_is_mask(context_raw.layer); let layered: bool = context_raw.layer != project_layers[0]; if (layered && !is_mask) { - if (context_raw.tool == workspace_tool_t.ERASER) { + if (context_raw.tool == tool_type_t.ERASER) { node_shader_write_frag(kong, "output[0] = float4(lerp3(sample_undo.rgb, float3(0.0, 0.0, 0.0), str), sample_undo.a - str);"); node_shader_write_frag(kong, "nortan = float3(0.5, 0.5, 1.0);"); node_shader_write_frag(kong, "occlusion = 1.0;"); @@ -403,7 +403,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad node_shader_write_frag(kong, "metallic = 0.0;"); node_shader_write_frag(kong, "matid = 0.0;"); } - else if (context_raw.tool == workspace_tool_t.PARTICLE || decal || context_raw.brush_mask_image != null) { + else if (context_raw.tool == tool_type_t.PARTICLE || decal || context_raw.brush_mask_image != null) { node_shader_write_frag(kong, "output[0] = float4(" + make_material_blend_mode(kong, context_raw.brush_blending, "sample_undo.rgb", "basecol", "str") + ", max(str, sample_undo.a));"); } else { @@ -431,7 +431,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad } } else { - if (context_raw.tool == workspace_tool_t.ERASER) { + if (context_raw.tool == tool_type_t.ERASER) { node_shader_write_frag(kong, "output[0] = float4(lerp3(sample_undo.rgb, float3(0.0, 0.0, 0.0), str), sample_undo.a - str);"); node_shader_write_frag(kong, "output[1] = float4(0.5, 0.5, 1.0, 0.0);"); node_shader_write_frag(kong, "output[2] = float4(1.0, 0.0, 0.0, 0.0);"); @@ -500,7 +500,7 @@ function make_paint_run(data: material_t, matcon: material_context_t): node_shad con_paint.data.color_writes_alpha[2] = false; } - if (context_raw.tool == workspace_tool_t.BAKE) { + if (context_raw.tool == tool_type_t.BAKE) { make_bake_run(con_paint, kong); } diff --git a/paint/sources/nodes/brush_output_node_ext.ts b/paint/sources/nodes/brush_output_node_ext.ts index a3dcc4ec..9a68165e 100644 --- a/paint/sources/nodes/brush_output_node_ext.ts +++ b/paint/sources/nodes/brush_output_node_ext.ts @@ -102,9 +102,9 @@ function brush_output_node_run(self: brush_output_node_t, from: i32) { // Do not paint over fill layer let fill_layer: bool = context_raw.layer.fill_layer != null && - 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.PICKER && + context_raw.tool != tool_type_t.MATERIAL && + context_raw.tool != tool_type_t.COLORID; if (fill_layer) { return; } @@ -133,14 +133,14 @@ function brush_output_paint(self: brush_output_node_t) { let down: bool = mouse_down() || pen_down(); // Set color pick - if (down && context_raw.tool == workspace_tool_t.COLORID && project_assets.length > 0) { + if (down && context_raw.tool == tool_type_t.COLORID && project_assets.length > 0) { context_raw.colorid_picked = true; ui_toolbar_handle.redraws = 1; } // Prevent painting the same spot let same_spot: bool = context_raw.paint_vec.x == context_raw.last_paint_x && context_raw.paint_vec.y == context_raw.last_paint_y; - let lazy: bool = context_raw.tool == workspace_tool_t.BRUSH && context_raw.brush_lazy_radius > 0; + let lazy: bool = context_raw.tool == tool_type_t.BRUSH && context_raw.brush_lazy_radius > 0; if (down && (same_spot || lazy)) { context_raw.painted++; } @@ -150,7 +150,7 @@ function brush_output_paint(self: brush_output_node_t) { context_raw.last_paint_x = context_raw.paint_vec.x; context_raw.last_paint_y = context_raw.paint_vec.y; - if (context_raw.tool == workspace_tool_t.PARTICLE) { + if (context_raw.tool == tool_type_t.PARTICLE) { context_raw.painted = 0; // Always paint particles } diff --git a/paint/sources/render_path_paint.ts b/paint/sources/render_path_paint.ts index e8776303..6f5befb3 100644 --- a/paint/sources/render_path_paint.ts +++ b/paint/sources/render_path_paint.ts @@ -117,13 +117,13 @@ function render_path_paint_commands_paint(dilation: bool = true) { let tid: i32 = context_raw.layer.id; if (context_raw.pdirty > 0) { - if (context_raw.tool == workspace_tool_t.COLORID) { + if (context_raw.tool == tool_type_t.COLORID) { render_path_set_target("texpaint_colorid", null, null, clear_flag_t.COLOR, 0xff000000); render_path_bind_target("gbuffer2", "gbuffer2"); render_path_paint_draw_fullscreen_triangle("paint"); ui_header_handle.redraws = 2; } - else if (context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL) { + else if (context_raw.tool == tool_type_t.PICKER || context_raw.tool == tool_type_t.MATERIAL) { if (context_raw.pick_pos_nor_tex) { if (context_raw.paint2d) { let additional: string[] = ["gbuffer1", "gbuffer2"]; @@ -155,7 +155,7 @@ function render_path_paint_commands_paint(dilation: bool = true) { render_path_set_target("texpaint_picker", additional); render_path_bind_target("gbuffer2", "gbuffer2"); tid = context_raw.layer.id; - let use_live_layer: bool = context_raw.tool == workspace_tool_t.MATERIAL; + let use_live_layer: bool = context_raw.tool == tool_type_t.MATERIAL; if (use_live_layer) { render_path_paint_use_live_layer(true); } @@ -226,7 +226,7 @@ function render_path_paint_commands_paint(dilation: bool = true) { else { let texpaint: string = "texpaint" + tid; - if (context_raw.tool == workspace_tool_t.BAKE && context_raw.brush_time == sys_delta()) { + if (context_raw.tool == tool_type_t.BAKE && context_raw.brush_time == sys_delta()) { // Clear to black on bake start render_path_set_target(texpaint, null, null, clear_flag_t.COLOR, 0xff000000); } @@ -261,17 +261,17 @@ function render_path_paint_commands_paint(dilation: bool = true) { } // Read texcoords from gbuffer - let read_tc: bool = (context_raw.tool == workspace_tool_t.FILL && context_raw.fill_type_handle.position == fill_type_t.FACE) || - context_raw.tool == workspace_tool_t.CLONE || - context_raw.tool == workspace_tool_t.BLUR || - context_raw.tool == workspace_tool_t.SMUDGE; + let read_tc: bool = (context_raw.tool == tool_type_t.FILL && context_raw.fill_type_handle.position == fill_type_t.FACE) || + context_raw.tool == tool_type_t.CLONE || + context_raw.tool == tool_type_t.BLUR || + context_raw.tool == tool_type_t.SMUDGE; if (read_tc) { render_path_bind_target("gbuffer2", "gbuffer2"); } render_path_draw_meshes("paint"); - if (context_raw.tool == workspace_tool_t.BAKE && context_raw.bake_type == bake_type_t.CURVATURE && context_raw.bake_curv_smooth > 0) { + if (context_raw.tool == tool_type_t.BAKE && context_raw.bake_type == bake_type_t.CURVATURE && context_raw.bake_curv_smooth > 0) { if (map_get(render_path_render_targets, "texpaint_blur") == null) { let t: render_target_t = render_target_create(); t.name = "texpaint_blur"; @@ -331,14 +331,14 @@ function render_path_paint_use_live_layer(use: bool) { } function render_path_paint_commands_live_brush() { - let tool: workspace_tool_t = context_raw.tool; - if (tool != workspace_tool_t.BRUSH && - tool != workspace_tool_t.ERASER && - tool != workspace_tool_t.CLONE && - tool != workspace_tool_t.DECAL && - tool != workspace_tool_t.TEXT && - tool != workspace_tool_t.BLUR && - tool != workspace_tool_t.SMUDGE) { + let tool: tool_type_t = context_raw.tool; + if (tool != tool_type_t.BRUSH && + tool != tool_type_t.ERASER && + tool != tool_type_t.CLONE && + tool != tool_type_t.DECAL && + tool != tool_type_t.TEXT && + tool != tool_type_t.BLUR && + tool != tool_type_t.SMUDGE) { return; } @@ -405,13 +405,13 @@ function render_path_paint_commands_cursor() { return; } let decal_mask: bool = context_is_decal_mask(); - let tool: workspace_tool_t = context_raw.tool; - if (tool != workspace_tool_t.BRUSH && - tool != workspace_tool_t.ERASER && - tool != workspace_tool_t.CLONE && - tool != workspace_tool_t.BLUR && - tool != workspace_tool_t.SMUDGE && - tool != workspace_tool_t.PARTICLE && + let tool: tool_type_t = context_raw.tool; + if (tool != tool_type_t.BRUSH && + tool != tool_type_t.ERASER && + tool != tool_type_t.CLONE && + tool != tool_type_t.BLUR && + tool != tool_type_t.SMUDGE && + tool != tool_type_t.PARTICLE && !decal_mask) { return; } @@ -504,9 +504,9 @@ function render_path_paint_commands_symmetry() { } function render_path_paint_paint_enabled(): bool { - let fill_layer: bool = context_raw.layer.fill_layer != null && context_raw.tool != workspace_tool_t.PICKER && context_raw.tool != workspace_tool_t.MATERIAL && context_raw.tool != workspace_tool_t.COLORID; + let fill_layer: bool = context_raw.layer.fill_layer != null && context_raw.tool != tool_type_t.PICKER && context_raw.tool != tool_type_t.MATERIAL && context_raw.tool != tool_type_t.COLORID; let group_layer: bool = slot_layer_is_group(context_raw.layer); - let gizmo: bool = context_raw.tool == workspace_tool_t.GIZMO; + let gizmo: bool = context_raw.tool == tool_type_t.GIZMO; return !fill_layer && !group_layer && !context_raw.foreground_event && !gizmo; } @@ -626,7 +626,7 @@ function render_path_paint_draw() { render_path_paint_dilated = false; } - if (context_raw.tool == workspace_tool_t.BAKE) { + if (context_raw.tool == tool_type_t.BAKE) { if (context_raw.bake_type == bake_type_t.NORMAL || context_raw.bake_type == bake_type_t.HEIGHT || context_raw.bake_type == bake_type_t.DERIVATIVE) { if (!render_path_paint_baking && context_raw.pdirty > 0) { @@ -803,7 +803,7 @@ function render_path_paint_restore_plane_mesh() { function render_path_paint_bind_layers() { let is_live: bool = config_raw.brush_live && render_path_paint_live_layer_drawn > 0; - let is_material_tool: bool = context_raw.tool == workspace_tool_t.MATERIAL; + let is_material_tool: bool = context_raw.tool == tool_type_t.MATERIAL; if (is_live || is_material_tool) { render_path_paint_use_live_layer(true); } @@ -821,7 +821,7 @@ function render_path_paint_bind_layers() { function render_path_paint_unbind_layers() { let is_live: bool = config_raw.brush_live && render_path_paint_live_layer_drawn > 0; - let is_material_tool: bool = context_raw.tool == workspace_tool_t.MATERIAL; + let is_material_tool: bool = context_raw.tool == tool_type_t.MATERIAL; if (is_live || is_material_tool) { render_path_paint_use_live_layer(false); } diff --git a/paint/sources/ui_base_ext.ts b/paint/sources/ui_base_ext.ts index deb3c4de..b924ed7f 100644 --- a/paint/sources/ui_base_ext.ts +++ b/paint/sources/ui_base_ext.ts @@ -13,8 +13,8 @@ function ui_base_ext_init_hwnd_tabs(): tab_draw_array_t[] { ]; let a2: tab_draw_array_t = [ _draw_callback_create(tab_browser_draw), - _draw_callback_create(tab_textures_draw), _draw_callback_create(tab_meshes_draw), + _draw_callback_create(tab_textures_draw), _draw_callback_create(tab_fonts_draw), _draw_callback_create(tab_swatches_draw), _draw_callback_create(tab_script_draw), diff --git a/paint/sources/ui_header_ext.ts b/paint/sources/ui_header_ext.ts index b0372fe0..b43973b1 100644 --- a/paint/sources/ui_header_ext.ts +++ b/paint/sources/ui_header_ext.ts @@ -2,7 +2,7 @@ let _ui_header_draw_tool_properties_h: ui_handle_t; function ui_header_draw_tool_properties(ui: ui_t) { - if (context_raw.tool == workspace_tool_t.COLORID) { + if (context_raw.tool == tool_type_t.COLORID) { ui_text(tr("Picked Color")); if (context_raw.colorid_picked) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); @@ -71,7 +71,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { } ui.enabled = true; } - else if (context_raw.tool == workspace_tool_t.PICKER || context_raw.tool == workspace_tool_t.MATERIAL) { + else if (context_raw.tool == tool_type_t.PICKER || context_raw.tool == tool_type_t.MATERIAL) { let base_r_picked: f32 = math_round(color_get_rb(context_raw.picked_color.base) / 255 * 10) / 10; let base_g_picked: f32 = math_round(color_get_gb(context_raw.picked_color.base) / 255 * 10) / 10; let base_b_picked: f32 = math_round(color_get_bb(context_raw.picked_color.base) / 255 * 10) / 10; @@ -140,7 +140,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { make_material_parse_paint_material(); } } - else if (context_raw.tool == workspace_tool_t.BAKE) { + else if (context_raw.tool == tool_type_t.BAKE) { ui.changed = false; let baking: bool = context_raw.pdirty > 0; @@ -288,19 +288,19 @@ function ui_header_draw_tool_properties(ui: ui_t) { make_material_parse_paint_material(); } } - else if (context_raw.tool == workspace_tool_t.BRUSH || - context_raw.tool == workspace_tool_t.ERASER || - context_raw.tool == workspace_tool_t.FILL || - 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) { + else if (context_raw.tool == tool_type_t.BRUSH || + context_raw.tool == tool_type_t.ERASER || + context_raw.tool == tool_type_t.FILL || + 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) { let decal: bool = context_is_decal(); let decal_mask: bool = context_is_decal_mask(); - if (context_raw.tool != workspace_tool_t.FILL) { + if (context_raw.tool != tool_type_t.FILL) { if (decal_mask) { context_raw.brush_decal_mask_radius = ui_slider(context_raw.brush_decal_mask_radius_handle, tr("Radius"), 0.01, 2.0, true); if (ui.is_hovered) { @@ -323,21 +323,21 @@ function ui_header_draw_tool_properties(ui: ui_t) { } } - if (context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT) { + if (context_raw.tool == tool_type_t.DECAL || context_raw.tool == tool_type_t.TEXT) { context_raw.brush_scale_x = ui_slider(context_raw.brush_scale_x_handle, tr("Scale X"), 0.01, 2.0, true); } - if (context_raw.tool == workspace_tool_t.BRUSH || - context_raw.tool == workspace_tool_t.FILL || - context_raw.tool == workspace_tool_t.DECAL || - context_raw.tool == workspace_tool_t.TEXT) { + if (context_raw.tool == tool_type_t.BRUSH || + context_raw.tool == tool_type_t.FILL || + context_raw.tool == tool_type_t.DECAL || + context_raw.tool == tool_type_t.TEXT) { let brush_scale_handle: ui_handle_t = ui_handle(__ID__); if (brush_scale_handle.init) { brush_scale_handle.value = context_raw.brush_scale; } context_raw.brush_scale = ui_slider(brush_scale_handle, tr("UV Scale"), 0.01, 5.0, true); if (brush_scale_handle.changed) { - if (context_raw.tool == workspace_tool_t.DECAL || context_raw.tool == workspace_tool_t.TEXT) { + if (context_raw.tool == tool_type_t.DECAL || context_raw.tool == tool_type_t.TEXT) { let current: gpu_texture_t = _draw_current; draw_end(); util_render_make_decal_preview(); @@ -364,7 +364,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { ui_tooltip(tr("Hold {brush_opacity} and move mouse to the left to decrease the opacity\nHold {brush_opacity} and move mouse to the right to increase the opacity", vars)); } - 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) { let h: ui_handle_t = ui_handle(__ID__); if (h.init) { h.value = context_raw.brush_hardness; @@ -372,7 +372,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { context_raw.brush_hardness = ui_slider(h, tr("Hardness"), 0.0, 1.0, true); } - if (context_raw.tool != workspace_tool_t.ERASER) { + if (context_raw.tool != tool_type_t.ERASER) { let brush_blending_handle: ui_handle_t = ui_handle(__ID__); if (brush_blending_handle.init) { brush_blending_handle.value = context_raw.brush_blending; @@ -403,7 +403,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { } } - if (context_raw.tool == workspace_tool_t.BRUSH || context_raw.tool == workspace_tool_t.FILL) { + if (context_raw.tool == tool_type_t.BRUSH || context_raw.tool == tool_type_t.FILL) { let paint_handle: ui_handle_t = ui_handle(__ID__); let texcoord_combo: string[] = [tr("UV Map"), tr("Triplanar"), tr("Project")]; context_raw.brush_paint = ui_combo(paint_handle, texcoord_combo, tr("TexCoord")); @@ -411,7 +411,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { make_material_parse_paint_material(); } } - if (context_raw.tool == workspace_tool_t.TEXT) { + if (context_raw.tool == tool_type_t.TEXT) { let h: ui_handle_t = ui_handle(__ID__); h.text = context_raw.text_tool_text; let w: i32 = ui._w; @@ -431,7 +431,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { } } - if (context_raw.tool == workspace_tool_t.FILL) { + if (context_raw.tool == tool_type_t.FILL) { let fill_mode_combo: string[] = [tr("Object"), tr("Face"), tr("Angle"), tr("UV Island")]; ui_combo(context_raw.fill_type_handle, fill_mode_combo, tr("Fill Mode")); if (context_raw.fill_type_handle.changed) { diff --git a/paint/sources/ui_toolbar_ext.ts b/paint/sources/ui_toolbar_ext.ts index 0ca51d64..f19ef593 100644 --- a/paint/sources/ui_toolbar_ext.ts +++ b/paint/sources/ui_toolbar_ext.ts @@ -1,17 +1,17 @@ function ui_toolbar_ext_draw_tools(ui: ui_t, img: gpu_texture_t, icon_accent: i32, keys: string[]) { - ui_toolbar_draw_tool(workspace_tool_t.BRUSH, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.ERASER, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.FILL, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.DECAL, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.TEXT, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.CLONE, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.BLUR, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.SMUDGE, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.PARTICLE, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.COLORID, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.PICKER, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.BAKE, ui, img, icon_accent, keys); - ui_toolbar_draw_tool(workspace_tool_t.MATERIAL, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.BRUSH, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.ERASER, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.FILL, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.DECAL, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.TEXT, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.CLONE, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.BLUR, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.SMUDGE, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.PARTICLE, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.COLORID, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.PICKER, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.BAKE, ui, img, icon_accent, keys); + ui_toolbar_draw_tool(tool_type_t.MATERIAL, ui, img, icon_accent, keys); }