Sim Nodes: Don't delete parent bake directory #110999

Merged
Falk David merged 4 commits from filedescriptor/blender:gn-bake-only-delete-meta-and-bdata-folders into main 2023-08-10 14:29:39 +02:00
Member

The OBJECT_OT_simulation_nodes_cache_delete operator
would delete the parent bake directory. This can result in catastrophic
loss of data if the user set their bake directory to a folder that
contains other data.

This patch makes sure that only the "meta" and "bdata" folders get
deleted in the parent directory.

The `OBJECT_OT_simulation_nodes_cache_delete` operator would delete the parent bake directory. This can result in catastrophic loss of data if the user set their bake directory to a folder that contains other data. This patch makes sure that only the "meta" and "bdata" folders get deleted in the parent directory.
Falk David added 1 commit 2023-08-10 13:13:43 +02:00
26843cda94 Sim Nodes: Don't delete parent bake directory
The `OBJECT_OT_simulation_nodes_cache_delete` operator
would delete the parent bake directory. This can result in catastrophic
loss of data if the user set their bake directory to a folder that
contains other data.

This patch makes sure that only the "meta" and "bdata" folders get
deleted in the parent directory.
Falk David added this to the Nodes & Physics project 2023-08-10 13:13:52 +02:00
Jacques Lucke requested changes 2023-08-10 13:24:20 +02:00
@ -609,2 +614,2 @@
BKE_reportf(
op->reports, RPT_ERROR, "Failed to remove bake directory %s", absolute_bake_dir);
if (!BLI_exists(meta_dir)) {
BKE_reportf(op->reports, RPT_ERROR, "Meta directory %s not found", meta_dir);
Member

Deletion should work without errors even if those folders don't exist. The following behavior makes sense to me: The meta and bdata dir should be deleted if they exist. The parent directory should only be deleted if it is now empty (otherwise, there can be a warning).

Deletion should work without errors even if those folders don't exist. The following behavior makes sense to me: The meta and bdata dir should be deleted if they exist. The parent directory should only be deleted if it is now empty (otherwise, there can be a warning).
Author
Member

I would never expect Blender to delete a folder that it didn't create. That seems super dodgy to me...

I would never expect Blender to delete a folder that it didn't create. That seems super dodgy to me...
Member

Generally speaking, Blender is expected to have generated this folder tbh. The bake folder is not expected to contain anything else.

Generally speaking, Blender is expected to have generated this folder tbh. The bake folder is not expected to contain anything else.
Member

Generally speaking, Blender is expected to have generated this folder tbh. The bake folder is not expected to contain anything else.

Generally speaking, Blender is expected to have generated this folder tbh. The bake folder is not expected to contain anything else.
Author
Member

But the bake folder can be set in the modifier. It can contain anything!

But the bake folder can be set in the modifier. It can contain anything!
Member

Yeah, quite possible that there are more cases that should show warnings. This was added fairly last minute, we did not intend to add this option originally but have a better more general solution for 4.0.
I think just doing what I proposed above will fix most issues.

Yeah, quite possible that there are more cases that should show warnings. This was added fairly last minute, we did not intend to add this option originally but have a better more general solution for 4.0. I think just doing what I proposed above will fix most issues.
filedescriptor marked this conversation as resolved
Falk David added 1 commit 2023-08-10 13:38:05 +02:00
Falk David requested review from Jacques Lucke 2023-08-10 13:38:45 +02:00
Author
Member

I think this should also be added to #109399

I think this should also be added to #109399
Member

I still think, if the bake folder is empty after meta and bdata has been removed, it should be removed as well. Otherwise, one can end up with potentially lots of empty folders that have been created by Blender. Blender will recreate those when baking again. There is no data loss, because it's only done if the folder is empty.

I still think, if the bake folder is empty after `meta` and `bdata` has been removed, it should be removed as well. Otherwise, one can end up with potentially lots of empty folders that have been created by Blender. Blender will recreate those when baking again. There is no data loss, because it's only done if the folder is empty.
Falk David added 1 commit 2023-08-10 14:12:33 +02:00
Falk David added 1 commit 2023-08-10 14:20:51 +02:00
Jacques Lucke approved these changes 2023-08-10 14:24:51 +02:00
Falk David merged commit 101abc6f6c into main 2023-08-10 14:29:39 +02:00
Falk David deleted branch gn-bake-only-delete-meta-and-bdata-folders 2023-08-10 14:29:41 +02:00
Sign in to join this conversation.
No reviewers
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 Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110999
No description provided.