paint: begin cursor tool

This commit is contained in:
luboslenco
2026-04-18 12:54:50 +02:00
parent 3150109fff
commit d95bc33b8a
17 changed files with 28 additions and 28 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

+6 -6
View File
@@ -259,7 +259,7 @@ void base_update(void *_) {
g_context->ddirty = 0;
}
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
if (keyboard_down("control") && keyboard_started("d")) {
sim_duplicate();
}
@@ -366,7 +366,7 @@ void base_render(void *_) {
base_init_undo_layers();
}
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
sim_init();
sim_update();
}
@@ -1207,12 +1207,12 @@ void ui_base_update(void *_) {
else if (operator_shortcut(any_map_get(config_keymap, "tool_bake"), SHORTCUT_TYPE_STARTED)) {
context_select_tool(TOOL_TYPE_BAKE);
}
else if (operator_shortcut(any_map_get(config_keymap, "tool_gizmo"), SHORTCUT_TYPE_STARTED)) {
context_select_tool(TOOL_TYPE_GIZMO);
}
else if (operator_shortcut(any_map_get(config_keymap, "tool_material"), SHORTCUT_TYPE_STARTED)) {
context_select_tool(TOOL_TYPE_MATERIAL);
}
else if (operator_shortcut(any_map_get(config_keymap, "tool_cursor"), SHORTCUT_TYPE_STARTED)) {
context_select_tool(TOOL_TYPE_CURSOR);
}
else if (operator_shortcut(any_map_get(config_keymap, "swap_brush_eraser"), SHORTCUT_TYPE_STARTED)) {
context_select_tool(g_context->tool == TOOL_TYPE_BRUSH ? TOOL_TYPE_ERASER : TOOL_TYPE_BRUSH);
}
@@ -1738,7 +1738,7 @@ void base_init() {
if (args_player) {
sys_notify_on_next_frame(&base_init_on_start_arm, NULL);
g_context->tool = TOOL_TYPE_GIZMO;
g_context->tool = TOOL_TYPE_CURSOR;
make_material_parse_paint_material(true);
g_config->workspace = WORKSPACE_PLAYER;
base_update_workspace();
+3 -3
View File
@@ -234,7 +234,7 @@ typedef enum {
TOOL_TYPE_PICKER = 10,
TOOL_TYPE_BAKE = 11,
TOOL_TYPE_MATERIAL = 12,
TOOL_TYPE_GIZMO = 13,
TOOL_TYPE_CURSOR = 13,
} tool_type_t;
typedef enum {
@@ -319,7 +319,7 @@ typedef enum {
ICON_PROPERTIES = 19,
ICON_FOLDER_OPEN = 20,
ICON_EMPTY = 21,
ICON_GIZMO = 22,
ICON_CURSOR = 22,
ICON_MATERIAL = 23,
ICON_MENU = 24,
ICON_FILE_NEW = 25,
@@ -382,7 +382,7 @@ typedef enum {
ICON_LABEL = 82,
ICON_ACCOUNT = 83,
ICON_ARROW_UP_LEFT = 84,
ICON_ATTACHMENT = 85,
ICON_GIZMO = 85,
ICON_BLOCK = 86,
ICON_LANDSCAPE = 87,
ICON_CHAT = 88,
+2 -2
View File
@@ -7,7 +7,7 @@ quat_t gizmo_q = (quat_t){0.0, 0.0, 0.0, 1.0};
quat_t gizmo_q0 = (quat_t){0.0, 0.0, 0.0, 1.0};
void gizmo_update() {
bool is_object = g_context->tool == TOOL_TYPE_GIZMO;
bool is_object = g_context->tool == TOOL_TYPE_CURSOR;
bool is_decal = base_is_decal_layer();
object_t *gizmo = g_context->gizmo;
@@ -19,7 +19,7 @@ void gizmo_update() {
object_t *paint_object = g_context->paint_object->base;
if (g_context->tool == TOOL_TYPE_GIZMO && g_context->selected_object != NULL) {
if (g_context->tool == TOOL_TYPE_CURSOR && g_context->selected_object != NULL) {
paint_object = g_context->selected_object;
}
+1 -1
View File
@@ -35,7 +35,7 @@ void import_asset_run(char *path, f32 drop_x, f32 drop_y, bool show_box, bool hd
}
if (path_is_mesh(path)) {
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
// project_import_mesh_box(path, false, false, tab_meshes_import_mesh_done);
project_import_mesh_box(path, false, false, tab_scene_import_mesh_done);
}
+1 -1
View File
@@ -193,7 +193,7 @@ char *_import_mesh_number_ext(i32 i) {
void _import_mesh_add_mesh(raw_mesh_t *mesh) {
mesh_data_t *raw = import_mesh_raw_mesh(mesh);
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
util_mesh_pack_uvs(mesh->texa);
}
+1 -1
View File
@@ -99,7 +99,7 @@ any_map_t *keymap_get_default() {
any_map_set(keymap, "tool_colorid", "c");
any_map_set(keymap, "tool_picker", "v");
any_map_set(keymap, "tool_bake", "k");
any_map_set(keymap, "tool_gizmo", "");
any_map_set(keymap, "tool_cursor", "");
any_map_set(keymap, "tool_material", "");
any_map_set(keymap, "swap_brush_eraser", "");
return keymap;
+1 -1
View File
@@ -113,7 +113,7 @@ void _kickstart() {
_tr("Picker"),
_tr("Bake"),
_tr("Material"),
_tr("Gizmo"),
_tr("Cursor"),
},
14);
gc_root(ui_toolbar_tool_names);
+2 -2
View File
@@ -336,7 +336,7 @@ node_shader_context_t *make_paint_run(material_t *data, material_context_t *matc
node_shader_write_frag(kong, "var opacity: float = mat_opacity;");
}
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
node_shader_write_frag(kong, "opacity = 1.0;");
}
else {
@@ -506,7 +506,7 @@ node_shader_context_t *make_paint_run(material_t *data, material_context_t *matc
node_shader_write_frag(kong,
"output[0] = float4((basecol * t_blur + sample_undo.rgb * sample_undo.a * (1.0 - t_blur)) / max(out_a, 0.0000001), out_a);");
}
else if (g_context->material->paint_opac_mode == OPACITY_MODE_TRANSLUC || g_context->tool == TOOL_TYPE_GIZMO || g_context->layer->fill_layer != NULL) {
else if (g_context->material->paint_opac_mode == OPACITY_MODE_TRANSLUC || g_context->tool == TOOL_TYPE_CURSOR || g_context->layer->fill_layer != NULL) {
node_shader_write_frag(kong, string("output[0] = float4(%s, %s);",
make_material_blend_mode(kong, g_context->brush_blending, "sample_undo.rgb", "basecol", "str"), "mat_opacity"));
}
+2 -2
View File
@@ -535,8 +535,8 @@ bool render_path_paint_paint_enabled() {
bool fill_layer = g_context->layer->fill_layer != NULL && g_context->tool != TOOL_TYPE_PICKER && g_context->tool != TOOL_TYPE_MATERIAL &&
g_context->tool != TOOL_TYPE_COLORID;
bool group_layer = slot_layer_is_group(g_context->layer);
bool gizmo = g_context->tool == TOOL_TYPE_GIZMO;
return !fill_layer && !group_layer && !g_context->foreground_event && !gizmo;
bool cursor = g_context->tool == TOOL_TYPE_CURSOR;
return !fill_layer && !group_layer && !g_context->foreground_event && !cursor;
}
void render_path_paint_live_brush_dirty() {
+4 -4
View File
@@ -16,7 +16,7 @@ void render_path_raytrace_commands(bool use_live_layer) {
render_path_raytrace_init_shader = true;
}
char *ext = "";
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
ext = "forge_";
}
char *mode = g_config->pathtrace_mode == PATHTRACE_MODE_FAST ? "core" : "full";
@@ -111,7 +111,7 @@ void render_path_raytrace_commands(bool use_live_layer) {
// g_context->ddirty = 1; // _RENDER
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
g_context->ddirty = 1;
}
}
@@ -123,7 +123,7 @@ void render_path_raytrace_build_data() {
mesh_object_t *mo = !context_layer_filter_used() ? g_context->merged_object : g_context->paint_object;
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
render_path_raytrace_transform = mo->base->transform->world_unpack;
}
else {
@@ -162,7 +162,7 @@ void render_path_raytrace_raytrace_init(char *shader_name, bool build) {
{
_gpu_raytrace_as_init();
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
for (i32 i = 0; i < project_paint_objects->length; ++i) {
mesh_object_t *po = project_paint_objects->buffer[i];
if (!po->base->visible) {
+2 -2
View File
@@ -1237,7 +1237,7 @@ void layers_create_fill_layer_on_next_frame(void *_) {
}
void layers_create_fill_layer(uv_type_t uv_type, mat4_t decal_mat, i32 position) {
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
return;
}
@@ -1570,7 +1570,7 @@ slot_layer_t *layers_flatten(bool height_to_normal, slot_layer_t_array_t *layers
draw_set_pipeline(NULL);
draw_end();
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
// Do not multiply basecol by alpha
draw_begin(layers_expa, false, 0); // Copy to temp
draw_set_pipeline(pipes_copy);
+1 -1
View File
@@ -636,7 +636,7 @@ void ui_header_draw_tool_properties() {
}
}
}
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
// if (!sim_running && ui_button("Play")) {
// sim_play();
// g_context.selected_object = scene_camera.base;
+1 -1
View File
@@ -73,7 +73,7 @@ f32 uniforms_ext_f32_link(object_t *object, material_data_t *mat, char *link) {
return val;
}
else if (string_equals(link, "_brush_scale")) {
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
i32 atlas_w = config_get_scene_atlas_res();
i32 item_w = config_get_layer_res();
i32 atlas_stride = atlas_w / (float)item_w;
+1 -1
View File
@@ -36,7 +36,7 @@ mesh_object_t_array_t *util_mesh_get_unique() {
void util_mesh_merge(mesh_object_t_array_t *paint_objects) {
if (paint_objects == NULL) {
if (g_context->tool == TOOL_TYPE_GIZMO) {
if (g_context->tool == TOOL_TYPE_CURSOR) {
paint_objects = util_mesh_get_unique();
}
else {