paint: add mesh icons

This commit is contained in:
luboslenco
2026-06-12 19:38:04 +02:00
parent f1625ccbaf
commit 627c4fe85b
5 changed files with 37 additions and 9 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 131 KiB

+12
View File
@@ -439,6 +439,18 @@ typedef enum {
ICON_TERMINAL = 129,
ICON_TRANSLATE = 130,
ICON_UPLOAD = 131,
ICON_RESERVED0 = 132,
ICON_RESERVED1 = 133,
ICON_RESERVED2 = 134,
ICON_RESERVED3 = 135,
ICON_RESERVED4 = 136,
ICON_RESERVED5 = 137,
ICON_UVSPHERE = 138,
ICON_PLANE = 139,
ICON_TORUS = 140,
ICON_CYLINDER = 141,
ICON_CONE = 142,
ICON_BOX = 143,
} icon_t;
typedef enum {
+25 -9
View File
@@ -421,9 +421,26 @@ void tab_meshes_append_shape(char *mesh_name) {
any_array_push(g_project->_->paint_objects, mo);
}
void tab_meshes_draw_append_shape() {
static icon_t tab_meshes_mesh_name_to_icon(char *s) {
if (starts_with(s, "box"))
return ICON_CUBE;
if (starts_with(s, "cone"))
return ICON_CONE;
if (starts_with(s, "cylinder"))
return ICON_CYLINDER;
if (starts_with(s, "torus"))
return ICON_TORUS;
if (starts_with(s, "plane"))
return ICON_PLANE;
if (starts_with(s, "sphere"))
return ICON_UVSPHERE;
return ICON_NONE;
}
void tab_meshes_draw_new() {
project_fetch_default_meshes();
for (i32 i = 0; i < project_default_mesh_list->length; ++i) {
if (ui_menu_button(project_default_mesh_list->buffer[i], "", ICON_NONE)) {
if (ui_menu_button(project_default_mesh_list->buffer[i], "", tab_meshes_mesh_name_to_icon(project_default_mesh_list->buffer[i]))) {
tab_meshes_append_shape(project_default_mesh_list->buffer[i]);
}
}
@@ -433,14 +450,9 @@ void tab_meshes_draw_import() {
if (ui_menu_button(tr("Replace Existing"), any_map_get(g_keymap, "file_import_assets"), ICON_NONE)) {
project_import_mesh(true, NULL);
}
if (ui_menu_button(tr("Append File"), "", ICON_NONE)) {
if (ui_menu_button(tr("Append"), "", ICON_NONE)) {
project_append_mesh();
}
if (ui_menu_button(tr("Append Shape"), "", ICON_NONE)) {
project_fetch_default_meshes();
ui_menu_draw(&tab_meshes_draw_append_shape, -1, -1);
}
}
static vec4_t aabb_center(mesh_data_t *raw) {
@@ -768,10 +780,14 @@ void tab_meshes_draw(ui_handle_t *htab) {
(f32[]){
-70,
-70,
-70,
},
2);
3);
ui_row(row);
if (ui_icon_button(tr("New"), ICON_PLUS, UI_ALIGN_CENTER)) {
ui_menu_draw(&tab_meshes_draw_new, -1, -1);
}
if (ui_icon_button(tr("Import"), ICON_IMPORT, UI_ALIGN_CENTER)) {
ui_menu_draw(&tab_meshes_draw_import, -1, -1);
}