Fix #68436: External Particle Disk Cache Playback Is Broken #117401

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:68436_b into main 2024-01-23 09:37:52 +01:00
Member

This has been broken since 2.8.

The highlevel reason for this is that the "info file" (saved as frame
zero) was not written anymore.
Reason for that in turn is that when calling BKE_ptcache_write outside
the bake job, the PTCacheID calldata (a psys in our case) is not the
evaluated particle system, causing a check for totpoint to fail (these
were always zero).

Deeper reasoning is unclear, no further investigations were done as to
why/when this happened.

The solution proposed here is using the evaluated psys when writing the
info frame (and this is isolated to just this spot and only to particle
systems). File then gets
written and can/will be read when using this as an external disk cache
in another file.

This has been broken since 2.8. The highlevel reason for this is that the "info file" (saved as frame zero) was not written anymore. Reason for that in turn is that when calling BKE_ptcache_write outside the bake job, the PTCacheID calldata (a psys in our case) is not the evaluated particle system, causing a check for totpoint to fail (these were always zero). Deeper reasoning is unclear, no further investigations were done as to why/when this happened. The solution proposed here is using the evaluated psys when writing the info frame (and this is isolated to just this spot and only to particle systems). File then gets written and can/will be read when using this as an external disk cache in another file.
Philipp Oeser added 1 commit 2024-01-22 11:47:17 +01:00
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
b07950fe79
Fix #68436: External Particle Disk Cache Playback Is Broken
This has been broken since 2.8.

The highlevel reason for this is that the "info file" (saved as frame
zero) was not written anymore.
Reason for that in turn is that when calling BKE_ptcache_write outside
the bake job, the PTCacheID calldata (a psys in our case) is not the
evaluated particle system, causing a check for totpoint to fail (these
were always zero).

Deeper reasoning is unclear, no further investigations were done as to
why/when this happened.

The solution proposed here is using the evaluated psys when writing the
info frame (and this is isolated to just this spot and only to particle
systems). File then gets
written and can/will be read when using this as an external disk cache
in another file.
Author
Member

@Sergey : this is the same as !117291 , except it now only does it for PTCACHE_TYPE_PARTICLES.
Afaict, only particle systems actually rely on the info frame anyways (so writing the info frame might actually be skipped otherwise -- but since there is a bit of uncertainty about this and not sure doing deeper tests are actually justified...)

@Sergey : this is the same as !117291 , except it now only does it for `PTCACHE_TYPE_PARTICLES`. Afaict, only particle systems actually rely on the info frame anyways (so writing the info frame might actually be skipped otherwise -- but since there is a bit of uncertainty about this and not sure doing deeper tests are actually justified...)
Philipp Oeser requested review from Sergey Sharybin 2024-01-22 11:51:46 +01:00
Philipp Oeser added this to the Nodes & Physics project 2024-01-22 11:51:52 +01:00
Sergey Sharybin approved these changes 2024-01-22 11:55:15 +01:00

@blender-bot build

@blender-bot build
Philipp Oeser requested review from Brecht Van Lommel 2024-01-22 12:03:12 +01:00
Brecht Van Lommel approved these changes 2024-01-22 15:47:10 +01:00
@ -3348,6 +3350,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
}
/* clear baking flag */
PTCacheID pid_eval;

Move inside if (pid->type == PTCACHE_TYPE_PARTICLES). Prefer to have variables declared as close as possible to their first use.

Move inside `if (pid->type == PTCACHE_TYPE_PARTICLES)`. Prefer to have variables declared as close as possible to their first use.
@ -3359,0 +3362,4 @@
/* Since writing this from outside the bake job, make sure the ParticleSystem and
* PTCacheID is in a fully evaluated state. */
ID *id = pid->owner_id;
Object *ob = (GS(id->name) == ID_OB) ? reinterpret_cast<Object *>(id) : nullptr;

Don't check GS(id->name) == ID_OB. If that fails the rest of the code here crashes anyway.

Don't check `GS(id->name) == ID_OB`. If that fails the rest of the code here crashes anyway.
lichtwerk marked this conversation as resolved
Philipp Oeser added 1 commit 2024-01-23 09:23:54 +01:00
Philipp Oeser merged commit c16b0216fe into main 2024-01-23 09:37:52 +01:00
Philipp Oeser deleted branch 68436_b 2024-01-23 09:37:54 +01:00
Sign in to join this conversation.
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
3 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#117401
No description provided.