paint: reset timeline

This commit is contained in:
luboslenco
2026-06-04 11:55:51 +02:00
parent 418f5af04b
commit e57de8fc79
4 changed files with 28 additions and 20 deletions
+1
View File
@@ -131,6 +131,7 @@ void import_blend_mesh_run(char *path, bool replace_existin
void tab_timeline_draw(ui_handle_t *htab); void tab_timeline_draw(ui_handle_t *htab);
void tab_timeline_export(project_t *raw); void tab_timeline_export(project_t *raw);
void tab_timeline_import(project_t *raw); void tab_timeline_import(project_t *raw);
void tab_timeline_reset();
void tab_timeline_prepare_save(); void tab_timeline_prepare_save();
void tab_timeline_finish_save(); void tab_timeline_finish_save();
void tab_timeline_play(); void tab_timeline_play();
+2
View File
@@ -197,6 +197,8 @@ void import_mesh_make_mesh(raw_mesh_t *mesh) {
md->_->handle = string_copy(raw->name); md->_->handle = string_copy(raw->name);
any_map_set(data_cached_meshes, md->_->handle, md); any_map_set(data_cached_meshes, md->_->handle, md);
tab_timeline_reset();
g_context->ddirty = 4; g_context->ddirty = 4;
ui_base_hwnds->buffer[TAB_AREA_SIDEBAR0]->redraws = 2; ui_base_hwnds->buffer[TAB_AREA_SIDEBAR0]->redraws = 2;
+1
View File
@@ -290,6 +290,7 @@ void project_new(bool reset_layers) {
g_context->picked_color = project_make_swatch(0xffffffff); g_context->picked_color = project_make_swatch(0xffffffff);
g_context->color_picker_callback = NULL; g_context->color_picker_callback = NULL;
history_reset(); history_reset();
tab_timeline_reset();
make_material_parse_paint_material(true); make_material_parse_paint_material(true);
make_material_parse_brush(); make_material_parse_brush();
+24 -20
View File
@@ -495,6 +495,29 @@ static void tab_timeline_init() {
gc_root(tab_timeline_mesh_origins); gc_root(tab_timeline_mesh_origins);
} }
void tab_timeline_reset() {
tab_timeline_init();
gc_unroot(tab_timeline_keyframes);
tab_timeline_keyframes = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_keyframes);
gc_unroot(tab_timeline_origins);
tab_timeline_origins = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_origins);
gc_unroot(tab_timeline_mesh_keyframes);
tab_timeline_mesh_keyframes = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_mesh_keyframes);
gc_unroot(tab_timeline_mesh_origins);
tab_timeline_mesh_origins = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_mesh_origins);
tab_timeline_selected_frame = 0;
tab_timeline_selected_row = 0;
tab_timeline_last_frame = 0;
tab_timeline_playing = false;
tab_timeline_scroll = 0;
}
static i32 _tab_timeline_frame = 0; static i32 _tab_timeline_frame = 0;
void tab_timeline_prepare_save() { void tab_timeline_prepare_save() {
@@ -576,26 +599,7 @@ static gpu_texture_t *tab_timeline_tex_from_buffer(buffer_t *buf, bool is_bgra)
} }
void tab_timeline_import(project_t *raw) { void tab_timeline_import(project_t *raw) {
tab_timeline_init(); tab_timeline_reset();
gc_unroot(tab_timeline_keyframes);
tab_timeline_keyframes = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_keyframes);
gc_unroot(tab_timeline_origins);
tab_timeline_origins = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_origins);
gc_unroot(tab_timeline_mesh_keyframes);
tab_timeline_mesh_keyframes = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_mesh_keyframes);
gc_unroot(tab_timeline_mesh_origins);
tab_timeline_mesh_origins = any_array_create_from_raw((void *[]){}, 0);
gc_root(tab_timeline_mesh_origins);
tab_timeline_selected_frame = 0;
tab_timeline_selected_row = 0;
tab_timeline_last_frame = 0;
tab_timeline_playing = false;
tab_timeline_scroll = 0;
if (raw->timeline_max_frames > 0) { if (raw->timeline_max_frames > 0) {
tab_timeline_frame_rate = raw->timeline_frame_rate; tab_timeline_frame_rate = raw->timeline_frame_rate;