paint: mesh split cleanup

This commit is contained in:
luboslenco
2026-04-18 16:49:48 +02:00
parent 8cb004ec34
commit 9421e37730
3 changed files with 10 additions and 9 deletions
+2 -3
View File
@@ -28,9 +28,8 @@ typedef enum {
typedef enum {
SPLIT_TYPE_OBJECT = 0,
SPLIT_TYPE_GROUP = 1,
SPLIT_TYPE_MATERIAL = 2,
SPLIT_TYPE_UDIM = 3,
SPLIT_TYPE_MATERIAL = 1,
SPLIT_TYPE_UDIM = 2,
} split_type_t;
typedef enum {
+1 -1
View File
@@ -4,7 +4,7 @@
void import_obj_run(char *path, bool replace_existing) {
split_type_t i = g_context->split_by;
bool is_udim = i == SPLIT_TYPE_UDIM;
i32 split_code = (i == SPLIT_TYPE_OBJECT || is_udim) ? char_code_at("o", 0) : i == SPLIT_TYPE_GROUP ? char_code_at("g", 0) : char_code_at("u", 0); // usemtl
i32 split_code = (i == SPLIT_TYPE_OBJECT || is_udim) ? 'o' : 'u'; // usemtl
buffer_t *b = data_get_blob(path);
+7 -5
View File
@@ -444,6 +444,7 @@ void project_append_mesh() {
}
extern int plugins_skinning_frame;
extern int plugins_split_by;
void project_import_mesh_box_draw() {
char *path = _project_import_mesh_box_path;
@@ -451,18 +452,18 @@ void project_import_mesh_box_draw() {
bool clear_layers = _project_import_mesh_box_clear_layers;
void (*done)(void) = _project_import_mesh_box_done;
if (ends_with(to_lower_case(path), ".obj")) {
if (ends_with(to_lower_case(path), ".obj") || ends_with(to_lower_case(path), ".fbx")) {
string_array_t *split_by_combo = any_array_create_from_raw(
(void *[]){
tr("Object"),
tr("Group"),
tr("Material"),
tr("UDIM Tile"),
},
4);
g_context->split_by = ui_combo(ui_handle(__ID__), split_by_combo, tr("Split By"), true, UI_ALIGN_LEFT, true);
3);
ui_text(tr("Split By"), UI_ALIGN_LEFT, 0);
g_context->split_by = plugins_split_by = ui_inline_radio(ui_handle(__ID__), split_by_combo, UI_ALIGN_LEFT);
if (ui->is_hovered) {
ui_tooltip(tr("Split .obj mesh into objects"));
ui_tooltip(tr("Split mesh into objects"));
}
}
@@ -489,6 +490,7 @@ void project_import_mesh_box_draw() {
},
3);
ui_end_element();
ui_row(row);
if (ui_icon_button(tr("Cancel"), ICON_CLOSE, UI_ALIGN_CENTER)) {
ui_box_hide();