Forge fixes

This commit is contained in:
luboslenco
2024-12-16 19:34:46 +01:00
parent 66d0bc194a
commit 5c629789a2
2 changed files with 21 additions and 1 deletions
+3
View File
@@ -130,6 +130,9 @@ function tab_scene_new_object(mesh_name: string) {
map_set(data_cached_meshes, md._.handle, md);
array_push(project_paint_objects, mo);
tab_scene_import_mesh_done();
app_notify_on_next_frame(function(mo: mesh_object_t) {
tab_scene_select_object(mo);
}, mo);
}
function tab_scene_new_menu(ui: ui_t) {
+18 -1
View File
@@ -1,8 +1,25 @@
function _util_mesh_unique_data_count(): i32 {
let count: i32 = 0;
for (let i: i32 = 0; i < project_paint_objects.length; ++i) {
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) {
count++;
}
}
return count;
}
function util_mesh_ext_pack_uvs(texa: i16_array_t) {
// Scale tex coords into global atlas
let atlas_w: i32 = config_get_texture_res();
let item_i: i32 = project_paint_objects.length;
let item_i: i32 = _util_mesh_unique_data_count();
let item_w: i32 = 2048;
let atlas_stride: i32 = atlas_w / item_w;
let atlas_step: i32 = 32767 / atlas_stride;