Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Important fixes for ArmorPaint + suggestion #1799

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ armorlab/assets/models/*.onnx
armorlab/assets/models/*.json
armorlab/assets/models/*.txt
armorlab/assets/models/*.zip
.ccls-cache
9 changes: 6 additions & 3 deletions armorcore/sources/ts/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,11 @@ function data_is_abs(file: string): bool {
return char_at(file, 0) == "/" || char_at(file, 1) == ":" || (char_at(file, 0) == "\\" && char_at(file, 1) == "\\");
}

function data_is_up(file: string): bool {
return char_at(file, 0) == "." && char_at(file, 1) == ".";
function data_is_rel(file: string): bool { // This function does not check for paths that
// don't begin in `.` or `..`, such paths are
// used in the code as `./data` paths. Read
// the comment I've written at import_arm.ts:4
return char_at(file, 0) == "." || (char_at(file, 0) == "." && char_at(file, 1) == ".");
}

function data_base_name(path: string): string {
Expand All @@ -333,7 +336,7 @@ function data_base_name(path: string): string {
}

function data_resolve_path(file: string): string {
if (data_is_abs(file) || data_is_up(file)) {
if (data_is_abs(file) || data_is_rel(file)) {
return file;
}
return data_path() + file;
Expand Down
16 changes: 11 additions & 5 deletions base/sources/export_arm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,17 @@ function export_arm_run_project() {
project_raw.camera_fov = scene_camera.data.fov;

///if (is_paint || is_sculpt)
// project_raw.mesh_datas = md; // TODO: fix GC ref
project_raw.mesh_datas.length = 0;
for (let i: i32 = 0; i < md.length; ++i) {
array_push(project_raw.mesh_datas, md[i]);
}
project_raw.mesh_datas = md; // TODO: fix GC ref // Best to keep an eye on this, there
// might be a bug reintroduced, or it might have been
// fixed already.
// project_raw.mesh_datas.length = 0; // This code assigns something to a null variable,
// which prevents saving any project. (At least in ArmorPaint.)
// Runtime tests may help prevent this kind of thing
// from happening again, because this is code that
// *does* make its way on the stores...
// for (let i: i32 = 0; i < md.length; ++i) {
// array_push(project_raw.mesh_datas, md[i]);
// }

project_raw.material_nodes = mnodes;
project_raw.brush_nodes = bnodes;
Expand Down
11 changes: 10 additions & 1 deletion base/sources/import_arm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@

let scene_raw_gc: scene_t;

function import_arm_run_project(path: string) {
function import_arm_run_project(path: string) { // This function should be rewritten to support
// relative paths passed on the command line,
// including just names. Paths starting from
// the current directory now work, but not
// names only, which is fundamentally
// impossible to implement unless this code was
// written to support it. Assuming people on
// Linux aren't going to use a command line
// and assuming all paths are full, absolute
// paths is a bad assumption to make.
let b: buffer_t = data_get_blob(path);
let project: project_format_t;
let import_as_mesh: bool = false;
Expand Down