Skip to content

Commit

Permalink
Forge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Dec 16, 2024
1 parent 66d0bc1 commit 5c62978
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions armorforge/sources/tab_scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
19 changes: 18 additions & 1 deletion armorforge/sources/util_mesh_ext.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 5c62978

Please sign in to comment.