paint: stage objects fixes

This commit is contained in:
luboslenco
2026-08-11 16:54:37 +02:00
parent f0e4ac180e
commit 66bb40efa4
8 changed files with 20 additions and 5 deletions
+1
View File
@@ -418,6 +418,7 @@ char *strings_graphics_api();
stage_t *tab_stages_create_stage(char *name);
stage_t *tab_stages_get_stage();
void tab_stages_apply(stage_t *stage);
void tab_stages_add_object(char *name);
void tab_stages_rename_object(char *old_name, char *new_name);
void tab_stages_rename_layer(char *old_name, char *new_name);
void script_set_stage(char *name);
+1
View File
@@ -255,6 +255,7 @@ void import_mesh_add_mesh(raw_mesh_t *mesh) {
raw->name = string("%s%s", raw->name, ext);
any_array_push(g_project->_->paint_objects, object);
tab_stages_add_object(object->base->name);
md->_->handle = string_copy(raw->name);
any_map_set(data_cached_meshes, md->_->handle, md);
+1
View File
@@ -88,6 +88,7 @@ void render_gizmo_update() {
g_context->gizmo_drag_last = g_context->gizmo_drag;
transform_build_matrix(paint_object->transform);
ui_header_handle->redraws = 2;
asim_body_t *pb = paint_object->_->body;
if (pb != NULL) {
+2 -1
View File
@@ -361,7 +361,8 @@ void render_path_paint_commands_paint(bool dilation) {
#endif
i32 index = r_byte - 1;
if (index >= 0 && index < g_project->_->paint_objects->length) {
g_context->paint_object = g_project->_->paint_objects->buffer[index];
g_context->paint_object = g_project->_->paint_objects->buffer[index];
ui_header_handle->redraws = 2;
// g_context->layer->object_mask = index + 1;
// context_set_layer(g_context->layer);
+1
View File
@@ -98,6 +98,7 @@ mesh_object_t *sim_duplicate_object(mesh_object_t *so) {
}
dup->base->name = string("%s%s", oname, ext);
dup->data->name = dup->base->name;
tab_stages_add_object(dup->base->name);
// Material override
i32 mat_index = tab_meshes_get_override(so);
+6 -3
View File
@@ -563,6 +563,7 @@ mesh_object_t *tab_meshes_append_shape(char *mesh_name) {
mo->base->raw = o;
any_map_set(data_cached_meshes, md->_->handle, md);
any_array_push(g_project->_->paint_objects, mo);
tab_stages_add_object(mo->base->name);
g_context->paint_object = mo;
return mo;
}
@@ -879,7 +880,8 @@ void tab_meshes_draw_mesh_slot(mesh_object_t *o, i32 i) {
if (hovered) {
ui_tooltip(o->base->name);
if (g_ui->input_started) {
g_context->paint_object = o;
g_context->paint_object = o;
ui_header_handle->redraws = 2;
tab_meshes_set_drag_mesh(o, -(mouse_x - uix - g_ui->_window_x - 3), -(mouse_y - uiy - g_ui->_window_y + 1));
}
if (g_ui->input_released) {
@@ -900,8 +902,9 @@ void tab_meshes_draw_mesh_slot(mesh_object_t *o, i32 i) {
}
}
if (g_ui->input_released_r) {
g_context->paint_object = o;
_tab_meshes_draw_i = i;
g_context->paint_object = o;
ui_header_handle->redraws = 2;
_tab_meshes_draw_i = i;
ui_menu_draw(&tab_meshes_draw_context_menu, -1, -1);
}
}
+1 -1
View File
@@ -595,7 +595,7 @@ void ui_header_draw_tool_properties() {
cursor_mode_handle->i = 0;
ui_combo(cursor_mode_handle, cursor_mode_combo, tr("Mode"), false, UI_ALIGN_LEFT, true);
mesh_object_t *o = context_main_object();
mesh_object_t *o = g_context->paint_object != NULL ? g_context->paint_object : context_main_object();
if (o != NULL && o->base != NULL && o->base->transform != NULL) {
i32 _w = g_ui->_w;
f32 sc = UI_SCALE();
+7
View File
@@ -34,6 +34,13 @@ void tab_stages_apply(stage_t *stage) {
g_context->ddirty = 2;
}
void tab_stages_add_object(char *name) {
stage_t *stage = tab_stages_get_stage();
if (stage != NULL && string_array_index_of(stage->objects, name) < 0) {
string_array_push(stage->objects, name);
}
}
void tab_stages_rename_object(char *old_name, char *new_name) {
if (g_project->stages == NULL || string_equals(old_name, new_name)) {
return;