paint: cleanup
This commit is contained in:
@@ -1391,13 +1391,18 @@ void ui_base_update(void *_) {
|
||||
base_is_resizing = false;
|
||||
}
|
||||
|
||||
if (g_context->tool == TOOL_TYPE_PARTICLE && context_in_paint_area() && !g_context->paint2d) {
|
||||
if (g_context->tool == TOOL_TYPE_PARTICLE) {
|
||||
util_particle_init_physics();
|
||||
physics_world_t *world = physics_world_active;
|
||||
physics_world_update(world);
|
||||
g_context->ddirty = 2;
|
||||
g_context->rdirty = 2;
|
||||
if (mouse_started("left")) {
|
||||
|
||||
if (g_context->particle_timer != NULL) {
|
||||
g_context->ddirty = 2;
|
||||
g_context->rdirty = 2;
|
||||
iron_delay_idle_sleep();
|
||||
}
|
||||
|
||||
if (mouse_started("left") && context_in_paint_area() && !g_context->paint2d) {
|
||||
if (g_context->particle_timer != NULL) {
|
||||
tween_stop(g_context->particle_timer);
|
||||
tween_anim_t *timer = g_context->particle_timer;
|
||||
@@ -1429,7 +1434,6 @@ void ui_base_update(void *_) {
|
||||
}
|
||||
|
||||
#ifdef arm_physics
|
||||
|
||||
physics_pair_t_array_t *pairs = physics_world_get_contact_pairs(world, g_context->paint_body);
|
||||
if (pairs != NULL) {
|
||||
for (i32 i = 0; i < pairs->length; ++i) {
|
||||
@@ -1444,7 +1448,6 @@ void ui_base_update(void *_) {
|
||||
break; // 1 pair for now
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ object_t *_compass_hovered = NULL;
|
||||
object_t *_compass_hovered_last = NULL;
|
||||
|
||||
void compass_render() {
|
||||
if (!g_context->show_compass || g_config->workspace == WORKSPACE_PLAYER) {
|
||||
if (!g_context->show_compass || g_config->workspace == WORKSPACE_PLAYER || g_context->capturing_screenshot) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ context_t *context_create() {
|
||||
c->show_envmap_handle = ui_handle_create();
|
||||
c->show_envmap_blur = false;
|
||||
c->show_envmap_blur_handle = ui_handle_create();
|
||||
c->capturing_screenshot = false;
|
||||
c->capture_background = false;
|
||||
c->envmap_angle = 0.0;
|
||||
c->light_angle = 0.0;
|
||||
c->cull_backfaces = true;
|
||||
|
||||
@@ -335,7 +335,6 @@ void ui_menu_sub_end();
|
||||
void render_path_base_init();
|
||||
void render_path_base_apply_config();
|
||||
f32 render_path_base_get_super_sampling();
|
||||
void render_path_base_draw_compass();
|
||||
void render_path_base_commands(void (*draw_commands)(void));
|
||||
void render_path_base_draw_bloom(char *source, char *target);
|
||||
void render_path_base_init_ssao();
|
||||
|
||||
@@ -30,10 +30,6 @@ f32 render_path_base_get_super_sampling() {
|
||||
return render_path_base_super_sample;
|
||||
}
|
||||
|
||||
void render_path_base_draw_compass() {
|
||||
compass_render();
|
||||
}
|
||||
|
||||
void render_path_base_begin() {
|
||||
// Begin split
|
||||
if (g_context->split_view && !g_context->paint2d_view) {
|
||||
|
||||
@@ -115,7 +115,7 @@ void render_path_deferred_draw_deferred() {
|
||||
render_path_draw_shader("Scene/compositor_pass/compositor_pass");
|
||||
|
||||
render_path_set_target("gbuffer1", NULL, NULL, GPU_CLEAR_NONE, 0, 0.0);
|
||||
render_path_base_draw_compass();
|
||||
compass_render();
|
||||
render_path_draw_meshes("overlay");
|
||||
render_path_base_draw_taa("gbuffer1", "buf");
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void render_path_forward_draw_forward() {
|
||||
render_path_draw_shader("Scene/compositor_pass/compositor_pass");
|
||||
|
||||
render_path_set_target("buf", NULL, NULL, GPU_CLEAR_NONE, 0, 0.0);
|
||||
render_path_base_draw_compass();
|
||||
compass_render();
|
||||
render_path_draw_meshes("overlay");
|
||||
|
||||
render_path_base_draw_taa("buf", "gbuffer1");
|
||||
|
||||
@@ -196,7 +196,7 @@ void render_path_raytrace_draw(bool use_live_layer) {
|
||||
render_path_set_target("buf", NULL, NULL, GPU_CLEAR_NONE, 0, 0.0);
|
||||
render_path_draw_meshes("overlay");
|
||||
render_path_set_target("buf", NULL, NULL, GPU_CLEAR_NONE, 0, 0.0);
|
||||
render_path_base_draw_compass();
|
||||
compass_render();
|
||||
render_path_set_target("last", NULL, NULL, GPU_CLEAR_NONE, 0, 0.0);
|
||||
render_path_bind_target("buf", "tex");
|
||||
render_path_draw_shader("Scene/compositor_pass/compositor_pass");
|
||||
|
||||
@@ -191,6 +191,8 @@ typedef struct context {
|
||||
struct ui_handle *show_envmap_handle;
|
||||
bool show_envmap_blur;
|
||||
struct ui_handle *show_envmap_blur_handle;
|
||||
bool capturing_screenshot;
|
||||
bool capture_background;
|
||||
f32 envmap_angle;
|
||||
f32 light_angle;
|
||||
bool cull_backfaces;
|
||||
|
||||
@@ -17,6 +17,7 @@ typedef struct update_info {
|
||||
} update_info_t;
|
||||
|
||||
i32 ui_menubar_category = 0;
|
||||
int ui_menubar_capture_screenshot_frame = 0;
|
||||
|
||||
void ui_menubar_init() {
|
||||
ui_menubar_hwnd->layout = UI_LAYOUT_HORIZONTAL;
|
||||
@@ -162,11 +163,15 @@ void ui_menubar_draw_category_items_on_check_for_updates_downloaded(char *url, b
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menubar_draw_category_items_capture_screenshot(void *_) {
|
||||
viewport_capture_screenshot();
|
||||
void ui_menubar_capture_screenshot(void *_) {
|
||||
ui_menubar_capture_screenshot_frame++;
|
||||
if (ui_menubar_capture_screenshot_frame == 2) {
|
||||
viewport_capture_screenshot();
|
||||
sys_remove_update(ui_menubar_capture_screenshot);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_menubar_draw_category_items_import_envmap(char *path) {
|
||||
void ui_menubar_import_envmap(char *path) {
|
||||
if (!ends_with(path, ".hdr")) {
|
||||
console_error(tr("Error: .hdr file expected"));
|
||||
return;
|
||||
@@ -279,7 +284,7 @@ void ui_menubar_draw_category_items() {
|
||||
project_import_asset(string_array_join(path_texture_formats(), ","), false);
|
||||
}
|
||||
if (ui_menu_button(tr("Envmap..."), "", ICON_LANDSCAPE)) {
|
||||
ui_files_show("hdr", false, false, &ui_menubar_draw_category_items_import_envmap);
|
||||
ui_files_show("hdr", false, false, &ui_menubar_import_envmap);
|
||||
}
|
||||
if (ui_menu_button(tr("Font..."), "", ICON_FONT)) {
|
||||
project_import_asset("ttf,ttc,otf", true);
|
||||
@@ -470,10 +475,18 @@ void ui_menubar_draw_category_items() {
|
||||
}
|
||||
|
||||
if (ui_menu_button(tr("Capture Screenshot"), "", ICON_PHOTO)) {
|
||||
sys_notify_on_next_frame(&ui_menubar_draw_category_items_capture_screenshot, NULL);
|
||||
g_context->capturing_screenshot = true;
|
||||
ui_menubar_capture_screenshot_frame = 0;
|
||||
sys_notify_on_update(&ui_menubar_capture_screenshot, NULL);
|
||||
ui->changed = false; // Close menu
|
||||
}
|
||||
|
||||
// if (g_config->experimental) {
|
||||
// ui_handle_t *h = ui_handle(__ID__);
|
||||
// h->b = g_context->capture_background;
|
||||
// g_context->capture_background = ui_check(h, tr("Capture Background"), "");
|
||||
// }
|
||||
|
||||
if (g_config->experimental && !viewport_recording && ui_menu_button(tr("Capture Video"), "", ICON_MOVIE)) {
|
||||
viewport_capture_video_begin();
|
||||
ui->changed = false; // Close menu
|
||||
|
||||
@@ -126,6 +126,8 @@ void viewport_capture_screenshot() {
|
||||
any_array_push(g_project->packed_assets, pa);
|
||||
any_map_set(data_cached_images, abs, screenshot);
|
||||
import_texture_run(abs, true);
|
||||
g_context->capturing_screenshot = false;
|
||||
g_context->ddirty = 2;
|
||||
}
|
||||
|
||||
void viewport_capture_video_update(void *_) {
|
||||
|
||||
Reference in New Issue
Block a user