paint: cleanup
This commit is contained in:
@@ -171,7 +171,7 @@ void args_run_on_next_frame(void *_) {
|
|||||||
if (string_equals(f, "")) {
|
if (string_equals(f, "")) {
|
||||||
f = string_copy(tr("untitled"));
|
f = string_copy(tr("untitled"));
|
||||||
}
|
}
|
||||||
export_mesh_run(string("%s%s%s", args_export_mesh_path, PATH_SEP, f), NULL, false, true);
|
export_mesh_run(string("%s%s%s", args_export_mesh_path, PATH_SEP, f), NULL, true);
|
||||||
}
|
}
|
||||||
else if (args_export_material) {
|
else if (args_export_material) {
|
||||||
g_context->write_icon_on_export = true;
|
g_context->write_icon_on_export = true;
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ void nodes_brush_list_init();
|
|||||||
ui_node_t *nodes_brush_create_node(char *node_type);
|
ui_node_t *nodes_brush_create_node(char *node_type);
|
||||||
void import_obj_run(char *path, bool replace_existing);
|
void import_obj_run(char *path, bool replace_existing);
|
||||||
void import_folder_run(char *path);
|
void import_folder_run(char *path);
|
||||||
void export_obj_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp);
|
void export_obj_run(char *path, mesh_object_t_array_t *paint_objects);
|
||||||
void export_obj_run_fast(char *path, mesh_object_t_array_t *paint_objects);
|
void export_obj_run_fast(char *path, mesh_object_t_array_t *paint_objects);
|
||||||
void export_obj_run_sculpt(char *path, mesh_object_t_array_t *paint_objects);
|
void export_obj_run_sculpt(char *path, mesh_object_t_array_t *paint_objects);
|
||||||
void make_blur_run(node_shader_t *kong);
|
void make_blur_run(node_shader_t *kong);
|
||||||
@@ -625,7 +625,7 @@ void console_toast(char *s);
|
|||||||
void console_info(char *s);
|
void console_info(char *s);
|
||||||
void console_error(char *s);
|
void console_error(char *s);
|
||||||
void console_log(char *s);
|
void console_log(char *s);
|
||||||
void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp, bool merge_vertices);
|
void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool merge_vertices);
|
||||||
void export_player_run(char *path);
|
void export_player_run(char *path);
|
||||||
void camera_init();
|
void camera_init();
|
||||||
void camera_update(void *_);
|
void camera_update(void *_);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
void export_glb_run(char *path, mesh_object_t_array_t *paint_objects);
|
void export_glb_run(char *path, mesh_object_t_array_t *paint_objects);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp, bool merge_vertices) {
|
void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool merge_vertices) {
|
||||||
if (paint_objects == NULL) {
|
if (paint_objects == NULL) {
|
||||||
paint_objects = g_project->_->paint_objects;
|
paint_objects = g_project->_->paint_objects;
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool appl
|
|||||||
export_obj_run_sculpt(path, paint_objects);
|
export_obj_run_sculpt(path, paint_objects);
|
||||||
}
|
}
|
||||||
else if (merge_vertices) {
|
else if (merge_vertices) {
|
||||||
export_obj_run(path, paint_objects, apply_disp);
|
export_obj_run(path, paint_objects);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
export_obj_run_fast(path, paint_objects);
|
export_obj_run_fast(path, paint_objects);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ static void export_obj_write_string(u8_array_t *out, char *str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void export_obj_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp) {
|
void export_obj_run(char *path, mesh_object_t_array_t *paint_objects) {
|
||||||
u8_array_t *o = u8_array_create_from_raw((u8[]){}, 0);
|
u8_array_t *o = u8_array_create_from_raw((u8[]){}, 0);
|
||||||
export_obj_write_string(o, "# armorpaint.org\n");
|
export_obj_write_string(o, "# armorpaint.org\n");
|
||||||
|
|
||||||
@@ -85,19 +85,6 @@ void export_obj_run(char *path, mesh_object_t_array_t *paint_objects, bool apply
|
|||||||
ti++;
|
ti++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (apply_disp) {
|
|
||||||
// let height: buffer_t = gpu_get_texture_pixels(layers[0].texpaint_pack);
|
|
||||||
// let res: i32 = layers[0].texpaint_pack.width;
|
|
||||||
// let strength: f32 = 0.1;
|
|
||||||
// for (let i: i32 = 0; i < len; ++i) {
|
|
||||||
// let x: i32 = math_floor(texa2[i * 2 ] / 32767 * res);
|
|
||||||
// let y: i32 = math_floor((1.0 - texa2[i * 2 + 1] / 32767) * res);
|
|
||||||
// let h: f32 = (1.0 - height.get((y * res + x) * 4 + 3) / 255) * strength;
|
|
||||||
// posa2[i * 3 ] -= math_floor(nora2[i * 3 ] * inv * h / sc);
|
|
||||||
// posa2[i * 3 + 1] -= math_floor(nora2[i * 3 + 1] * inv * h / sc);
|
|
||||||
// posa2[i * 3 + 2] -= math_floor(nora2[i * 3 + 2] * inv * h / sc);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
export_obj_write_string(o, string("o %s\n", p->base->name));
|
export_obj_write_string(o, string("o %s\n", p->base->name));
|
||||||
for (i32 i = 0; i < pi; ++i) {
|
for (i32 i = 0; i < pi; ++i) {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
bool _box_export_bake_material;
|
bool _box_export_bake_material;
|
||||||
export_preset_texture_t *_box_export_t;
|
export_preset_texture_t *_box_export_t;
|
||||||
bool _box_export_apply_displacement;
|
|
||||||
bool _box_export_merge_vertices;
|
bool _box_export_merge_vertices;
|
||||||
|
|
||||||
void box_export_tab_export_textures_run(void *_) {
|
void box_export_tab_export_textures_run(void *_) {
|
||||||
@@ -438,7 +437,7 @@ void box_export_tab_export_mesh_path_picked(char *path) {
|
|||||||
},
|
},
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
export_mesh_run(string("%s%s%s", path, PATH_SEP, f), paint_objects, _box_export_apply_displacement, _box_export_merge_vertices);
|
export_mesh_run(string("%s%s%s", path, PATH_SEP, f), paint_objects, _box_export_merge_vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void box_export_tab_export_mesh(ui_handle_t *htab) {
|
void box_export_tab_export_mesh(ui_handle_t *htab) {
|
||||||
@@ -473,8 +472,6 @@ void box_export_tab_export_mesh(ui_handle_t *htab) {
|
|||||||
}
|
}
|
||||||
ui_combo(box_export_mesh_handle, ar, tr("Meshes"), true, UI_ALIGN_LEFT, true);
|
ui_combo(box_export_mesh_handle, ar, tr("Meshes"), true, UI_ALIGN_LEFT, true);
|
||||||
|
|
||||||
bool apply_displacement = ui_check(ui_handle(__ID__), tr("Apply Displacement"), "");
|
|
||||||
|
|
||||||
ui_handle_t *hmerge = ui_handle(__ID__);
|
ui_handle_t *hmerge = ui_handle(__ID__);
|
||||||
if (hmerge->init) {
|
if (hmerge->init) {
|
||||||
hmerge->b = true;
|
hmerge->b = true;
|
||||||
@@ -507,8 +504,7 @@ void box_export_tab_export_mesh(ui_handle_t *htab) {
|
|||||||
}
|
}
|
||||||
if (ui_icon_button(tr("Export"), ICON_CHECK, UI_ALIGN_CENTER)) {
|
if (ui_icon_button(tr("Export"), ICON_CHECK, UI_ALIGN_CENTER)) {
|
||||||
ui_box_hide();
|
ui_box_hide();
|
||||||
_box_export_apply_displacement = apply_displacement;
|
_box_export_merge_vertices = merge_vertices;
|
||||||
_box_export_merge_vertices = merge_vertices;
|
|
||||||
ui_files_show(export_mesh_format_combo->buffer[g_context->export_mesh_format], true, false, &box_export_tab_export_mesh_path_picked);
|
ui_files_show(export_mesh_format_combo->buffer[g_context->export_mesh_format], true, false, &box_export_tab_export_mesh_path_picked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user