Fix #108263: Show warning when cache baking wants to overwrite data #108288
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108288
Loading…
Reference in New Issue
No description provided.
Delete Branch "LukasTonne/blender:warn_on_bake_dir_conflict"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Modifiers can use the same bake directory now. If multiple modifiers
using conflicting paths are baked at the same time there is now a
warning.
Modifiers can also bake to directories that already contain data
(including their own). To give users a heads-up there is now a
confirmation popup in that case. It only comes up once per bake operator
invoke to strike a balance between silently overwriting data and not
being too obnoxious when users want to rebake the same simulation many
times.
Show warning/confirmation when cache baking wants to overwrite datato Fix #108263: Show warning when cache baking wants to overwrite data@ -8,6 +8,7 @@
#include "BLI_endian_switch.h"
#include "BLI_fileops.hh"
#include "BLI_path_util.h"
#include "BLI_probing_strategies.hh"
Do you really need this specific header? I would expect it to be used only by files that implement hash tables.
I needed it for the definition of the
PathUsersMap
below, which uses specialized string comparison for paths. I may be missing something, but i think we can only specify template arguments in order in C++17. So i need to add that ProbingStrategy parameter before i can specify the hash and equality arguments. I'd be delighted if i'm wrong!Include isn't needed any more, removed.
@ -410,0 +413,4 @@
char norm_buf[256];
const size_t size = s.size() + 1;
char *norm = (size <= sizeof(norm_buf)) ? norm_buf :
static_cast<char *>(MEM_mallocN(size, __func__));
Looks like this is leaking. You could use
DynamicStackBuffer
.@ -410,0 +434,4 @@
}
};
static bool try_find_bake_directories(const StringRefNull absolute_bake_dir)
bool bake_directory_has_data(...)
@ -410,0 +419,4 @@
BLI_path_slash_rstrip(norm);
BLI_path_normalize(norm);
return DefaultHash<StringRef>()(norm);
Can use
get_default_hash
.@ -410,0 +465,4 @@
const char *base_path = ID_BLEND_PATH(bmain, &object->id);
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
if (md->type == eModifierType_Nodes) {
Use early
continue
to avoid indentation.@ -410,0 +504,4 @@
for (const auto &item : path_users.items()) {
/* Check if multiple caches are writing to the same bake directory. */
if (item.value > 1) {
BKE_reportf(op->reports, RPT_WARNING, "Multiple caches baked to path %s", item.key.data());
Think there should be confirmation dialog in this case as well.
Had some discussion with @dfelinto about this issue, agreed on:
We also discussed the possibility of fixing directory paths automatically. Currently, when copying an object the bake path remains the same, leading to a path conflict. We can clear the path on copy to avoid frequent conflicts. The paths might then be auto-generated to the default on running the bake operator.
Fixing paths by appending a ".001" suffix is difficult because we don't know all the objects/modifiers that might have conflicts (e.g. in linked files). We only know a concrete set of paths to check when actually running the operator.
b03d67fae2
to83cb0ccc25
e03ac8509d
to26e0c452ef
This should be ready now. I'll add "clear paths on copy" in a separate patch.
Error message when paths are conflicting (operator exits):
Warning when bake directory contains data (continues if user confirms):
I was wondering if we do need a warning when overriding existing data. We have no warning when we do it for animation or rendering.
Not sure what you mean by overriding animation data.
For the render output path, a notable difference is that there is only 1 render output path, but potentially many different bake paths. Not sure what it looks like in practice, but users might have many different cache paths so it would be much easier to accidentally overwrite caches.