Simulation cache can not be saved for linked objects #36382

Closed
opened 2013-08-05 09:56:24 +02:00 by Gatis Kurzemnieks · 17 comments

%%%--- Operating System, Graphics card ---
Windows 8, 64 bit, GeForce 780gtx

- Blender version with error, and version that worked ---

All versions

- Short description of error ---

Simulation cache can not be saved for linked objects. I have character with soft body and cloth modifiers applied. When I link this character in other scene to animate - there is no way to save baked dynamics cache.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---
  1. make object with dynamics
  2. link object in another scene
  3. bake dynamics
  4. try to save dynamics / reload scene - all is gone :(

%%%

%%%--- Operating System, Graphics card --- Windows 8, 64 bit, GeForce 780gtx - Blender version with error, and version that worked --- All versions - Short description of error --- Simulation cache can not be saved for linked objects. I have character with soft body and cloth modifiers applied. When I link this character in other scene to animate - there is no way to save baked dynamics cache. - Steps for others to reproduce the error (preferably based on attached .blend file) --- 1. make object with dynamics 2. link object in another scene 3. bake dynamics 4. try to save dynamics / reload scene - all is gone :( %%%

Changed status to: 'Open'

Changed status to: 'Open'
Member

%%%This is a design limitation more than an actual bug: the baked cache data is part of the object data, which is always loaded from the original file when linked. The linked copy of such objects is usually made non-editable by disabling most operators and buttons, but internally it's just a copy of the data and can still be modified. The point cache baking also still "works" locally, but as you noticed the data gets discarded after reload.

Baking point cache data should happen in the original file where the actual object lives. Then the cache data will be loaded as part of the linked object. This solution, however, may not be ideal, since it's likely that the original file does not contain all the colliders and other objects that determine the simulation outcome.

Ideally one would separately store the actual linked object data and then create a local object in the scene that uses this linked data, while storing point cache locally. However, this would currently only work for particles with their separate ParticleSettings data block. Softbody and cloth otoh are just modifiers which store all the settings as part of the object itself, so it's impossible to disconnect from the object and link only the settings. I'm afraid this will have to wait until a physics/modifier redesign takes place ...%%%

%%%This is a design limitation more than an actual bug: the baked cache data is part of the object data, which is always loaded from the original file when linked. The linked copy of such objects is usually made non-editable by disabling most operators and buttons, but internally it's just a copy of the data and can still be modified. The point cache baking also still "works" locally, but as you noticed the data gets discarded after reload. Baking point cache data should happen in the original file where the actual object lives. Then the cache data will be loaded as part of the linked object. This solution, however, may not be ideal, since it's likely that the original file does not contain all the colliders and other objects that determine the simulation outcome. Ideally one would separately store the actual linked object data and then create a local object in the scene that uses this linked data, while storing point cache locally. However, this would currently only work for particles with their separate ParticleSettings data block. Softbody and cloth otoh are just modifiers which store all the settings as part of the object itself, so it's impossible to disconnect from the object and link only the settings. I'm afraid this will have to wait until a physics/modifier redesign takes place ...%%%

%%%This is indeed a known limitation of the current physics and point cache system, so this report should be closed as a todo item.

There is a workaround to make local point caches for files with some python scripting, that was used for the Sintel open movie project. In each scene that you use the object, you can create a python script that runs on load and enables the disk cache setting on the point cache, and sets a unique file path to save it to. I don't have the Sintel DVD here but it had some scripts, maybe you can ask on blenderartists for that or see if there are other scripts online somewhere.%%%

%%%This is indeed a known limitation of the current physics and point cache system, so this report should be closed as a todo item. There is a workaround to make local point caches for files with some python scripting, that was used for the Sintel open movie project. In each scene that you use the object, you can create a python script that runs on load and enables the disk cache setting on the point cache, and sets a unique file path to save it to. I don't have the Sintel DVD here but it had some scripts, maybe you can ask on blenderartists for that or see if there are other scripts online somewhere.%%%

%%%So it seems I was too quick, this apparently used to work until recently with the right configuration and is broken now (sometime since siggraph or around then according to Bassam). For objects in a group you could use pinning to show them in the properties editor, and then ensure you have library cache path enabled.

Duplicate report here:
https://projects.blender.org/tracker/?func=detail&atid=498&aid=36418&group_id=9%%%

%%%So it seems I was too quick, this apparently used to work until recently with the right configuration and is broken now (sometime since siggraph or around then according to Bassam). For objects in a group you could use pinning to show them in the properties editor, and then ensure you have library cache path enabled. Duplicate report here: https://projects.blender.org/tracker/?func=detail&atid=498&aid=36418&group_id=9%%%

%%%So, I tried the steps in the other bug report and that particular case does not seem to be something that recently broke, maybe it's some other point cache configuration that used to work but now doesn't anymore.

What seems to work ok for me is enable Disk Cache and disable Use Library Path in the original .blend. Then you can bake per scene .blend, that's actually not too complex, no scripting required.%%%

%%%So, I tried the steps in the other bug report and that particular case does not seem to be something that recently broke, maybe it's some other point cache configuration that used to work but now doesn't anymore. What seems to work ok for me is enable Disk Cache and disable Use Library Path in the original .blend. Then you can bake per scene .blend, that's actually not too complex, no scripting required.%%%

%%%I've added a message now to the point cache panel for linked objects, modified the Use Lib Path tooltip to be more clear, and grayed out the bake buttons in case disk cache is disabled. As far as I can tell this is working as it should now.%%%

%%%I've added a message now to the point cache panel for linked objects, modified the Use Lib Path tooltip to be more clear, and grayed out the bake buttons in case disk cache is disabled. As far as I can tell this is working as it should now.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

%%%The bake buttons are now grayed out even when disc cache is enabled. It just shows the info message.

Also, is there any way to at least enable the frame range settings too for the local bakes? It's sort of pointless being able to bake but not having control of the frame range.

Was a single script used in Sintel for this (if so, which one was it.) or was it a new/modified one for each shot file? If I can get it working I'll try and document it in a blog or video tutorial. Thanks.%%%

%%%The bake buttons are now grayed out even when disc cache is enabled. It just shows the info message. Also, is there any way to at least enable the frame range settings too for the local bakes? It's sort of pointless being able to bake but not having control of the frame range. Was a single script used in Sintel for this (if so, which one was it.) or was it a new/modified one for each shot file? If I can get it working I'll try and document it in a blog or video tutorial. Thanks.%%%

%%%Fixed the buttons being grayed out when they shouldn't be.

Making the frame range local is not possible in the current design of Blender datablock linking. I don't have the files with me here, but what I think we basically had script that runs on load and overrides variables, frame ranges but also stiffness and such in case it needs to be tweaked for a particular shot.

ob = bpy.data.objects["SomeObject"]
cache = ob.modifiers["Cloth"].point_cache
cache.frame_start = ...
cache.frame_end = ...%%%

%%%Fixed the buttons being grayed out when they shouldn't be. Making the frame range local is not possible in the current design of Blender datablock linking. I don't have the files with me here, but what I think we basically had script that runs on load and overrides variables, frame ranges but also stiffness and such in case it needs to be tweaked for a particular shot. ob = bpy.data.objects["SomeObject"] cache = ob.modifiers["Cloth"].point_cache cache.frame_start = ... cache.frame_end = ...%%%

%%%I found it. finals_config.py in the Sintel production directory pro->Scripts->Modules folder.

It looks like Campbell hardcoded 67 cloth presets for Sintel alone in this single file. That's not very user-friendly. So that's not really a workable solution outside of a few people who know Blender internally pretty well (I read Bassam was using it on Tube, or at least was.)

I'm not at all familiar with python so I don't actually know what to do with that code you offered (sorry). It looks like just expressions that need to go into an actual script(?) Without being able to edit the settings also it's probably not going to be very useful so I'll probably just append the cloth objects this time, since my focus right now has to be on production. However if I can reverse engineer some of this code I'd like to try to write something that would be more generic and user-friendly. I assume it could be setup to, instead of having to hard-code each of the settings changes, create an actual UI panel (or use the existing cloth settings panel if that's possible?) to input the values. And of course make it non-object specific so the script can work for anything. Maybe develop it into an add-on in the medium term if there's interest.

It's not really a showstopper, but this would be nice to have for future productions as an add-on, at least until library linking gets rewritten in Blender.

Okay, thanks for indulging me. I started a BA thread, so I'll move this conversation there and off the bug tracker, for anyone interested in continuing the discussion: http://blenderartists.org/forum/showthread.php?309736-Library-Linking-Cloth-Simulation-Settings%%%

%%%I found it. finals_config.py in the Sintel production directory pro->Scripts->Modules folder. It looks like Campbell hardcoded 67 cloth presets for Sintel alone in this single file. That's not very user-friendly. So that's not really a workable solution outside of a few people who know Blender internally pretty well (I read Bassam was using it on Tube, or at least was.) I'm not at all familiar with python so I don't actually know what to do with that code you offered (sorry). It looks like just expressions that need to go into an actual script(?) Without being able to edit the settings also it's probably not going to be very useful so I'll probably just append the cloth objects this time, since my focus right now has to be on production. However if I can reverse engineer some of this code I'd like to try to write something that would be more generic and user-friendly. I assume it could be setup to, instead of having to hard-code each of the settings changes, create an actual UI panel (or use the existing cloth settings panel if that's possible?) to input the values. And of course make it non-object specific so the script can work for anything. Maybe develop it into an add-on in the medium term if there's interest. It's not really a showstopper, but this would be nice to have for future productions as an add-on, at least until library linking gets rewritten in Blender. Okay, thanks for indulging me. I started a BA thread, so I'll move this conversation there and off the bug tracker, for anyone interested in continuing the discussion: http://blenderartists.org/forum/showthread.php?309736-Library-Linking-Cloth-Simulation-Settings%%%

In 2.7rc2 cache is still not saved. You can bake cache in scene with linked object and everything seems fine, but when you reload - all cache is lost. I tried all options - "use lib path" is not checked and "disk cache" is checked, but still no luck. Am I missing something?

In 2.7rc2 cache is still not saved. You can bake cache in scene with linked object and everything seems fine, but when you reload - all cache is lost. I tried all options - "use lib path" is not checked and "disk cache" is checked, but still no luck. Am I missing something?

Added subscriber: @AdamTentacles

Added subscriber: @AdamTentacles

I think I agree that this is an unfixed bug.

TEST CASE

Here is a .zip file:
http://tentacles.org.uk/temp/BakeLinkedDynamicsTest.zip

It contains two .blends.

One, "HairyBaseObject.blend", contains a single plane with a hair particle system with hair dynamics turned on. The hair system is tuned to have a disk-cache, without library paths. The single plane is in a group for export.

Two, "SceneWithLinks.blend", contains a linked group instance linking to HairyBaseObject.

Steps To Reproduce:

  1. Load "SceneWithLinks.blend"
  2. Un-Pin HairyBaseObject.
  3. Re-Pin it.
  4. Select "L HairyBaseObject" from objeect drop-menu
  5. Click the cache's "Bake" button to bake the dynamics. Takes a few seconds.
  6. Scrob the timeline slider back and forth, observe the hair falling under gravity.
  7. Close blender
  8. Re-open blender, loading "SceneWithLinks.blend"
  9. Scrob the timeline slider backwards, observing the hair moving
  10. Scrob the timeline slider forwards, observing the hair restoring to upright position due to the baked cache being deleted.

It seems Blender is invalidating the cache for all frame ahead of whatever frame you look at.

As a work-around I tried, after step 6, chmodding all the cache files to root, so blender couldn't delete them.

This seems to work in the simple test case here, though it's not helping on my crazy complicated work-in-progress scene unfortunately.

That's using 2.7 release version.

Hope the test case helps narrow it down, tried to write the kinda bug-report-update that I wish my testers would write.

I think I agree that this is an unfixed bug. TEST CASE ----------------------- Here is a .zip file: http://tentacles.org.uk/temp/BakeLinkedDynamicsTest.zip It contains two .blends. One, "HairyBaseObject.blend", contains a single plane with a hair particle system with hair dynamics turned on. The hair system is tuned to have a disk-cache, without library paths. The single plane is in a group for export. Two, "SceneWithLinks.blend", contains a linked group instance linking to HairyBaseObject. Steps To Reproduce: 1) Load "SceneWithLinks.blend" 2) Un-Pin HairyBaseObject. 3) Re-Pin it. 4) Select "L HairyBaseObject" from objeect drop-menu 5) Click the cache's "Bake" button to bake the dynamics. Takes a few seconds. 6) Scrob the timeline slider back and forth, observe the hair falling under gravity. 7) Close blender 8) Re-open blender, loading "SceneWithLinks.blend" 9) Scrob the timeline slider backwards, observing the hair moving 10) Scrob the timeline slider forwards, observing the hair restoring to upright position due to the baked cache being deleted. It seems Blender is invalidating the cache for all frame ahead of whatever frame you look at. As a work-around I tried, after step 6, chmodding all the cache files to root, so blender couldn't delete them. This seems to work in the simple test case here, though it's not helping on my crazy complicated work-in-progress scene unfortunately. That's using 2.7 release version. Hope the test case helps narrow it down, tried to write the kinda bug-report-update that I wish my testers would write.

Ahha, okay. I can in fact make it work as I think it ought. Subtle little thing.

Presumably the linked object has some sort of "this object has a baked cache" flag.

When you link to that object, that flag is copied from the source object into the scene.

So if the scene containing the original object isn't baked, then when you link that object into another scene it treats the baked physics as a cache instead of a bake. Becasue the flag in the original object says it's not baked.

So to make things work properly, in this example test above, you need to open HairyBaseObject.blend and bake it, even if only one frame, then save the HairyBaseObject.blend file with a baked physics.

Then, when the SceneWithLinks is loaded it links to a BaseObject with a 'is baked' flag, and so doesn't delete the physics frames.

So. Bug is right to be closed, though the featuers/area certainly needs work. Hopefully that's the kinda thing that'll be worked on during Gooseberry I guess, linking and whatnot.

Hope that helps someone.

Ahha, okay. I can in fact make it work as I think it ought. Subtle little thing. Presumably the linked object has some sort of "this object has a baked cache" flag. When you link to that object, that flag is copied from the source object into the scene. So if the scene containing the original object isn't baked, then when you link that object into another scene it treats the baked physics as a cache instead of a bake. Becasue the flag in the original object says it's not baked. So to make things work properly, in this example test above, you need to open HairyBaseObject.blend and bake it, even if only one frame, then save the HairyBaseObject.blend file with a baked physics. Then, when the SceneWithLinks is loaded it links to a BaseObject with a 'is baked' flag, and so doesn't delete the physics frames. So. Bug is right to be closed, though the featuers/area certainly needs work. Hopefully that's the kinda thing that'll be worked on during Gooseberry I guess, linking and whatnot. Hope that helps someone.

Added subscriber: @StephenHamacek

Added subscriber: @StephenHamacek

@AdamTentacles thanks for posting, Glad there is a workaround—been trying to figure this out too.

@AdamTentacles thanks for posting, Glad there is a workaround—been trying to figure this out too.

Just a followup to confirm your experience @pre.

After baking a frame or two in the library file (I'm using lib path unchecked to keep bake in scene directory), I can then load my scene, hit 'free bake' to allow baking, then 'bake all dynamics' and the dummy frames stay put and the new bake goes in my scene directory without deleting on save.

@brecht This is still a bit messy I guess, but maybe we could have a kind of 'fake bake' checkbox to achieve this trick somehow. Might solve a lot of hassle till the system gets a rejig.

Cheers.

Just a followup to confirm your experience @pre. After baking a frame or two in the library file (I'm using lib path unchecked to keep bake in scene directory), I can then load my scene, hit 'free bake' to allow baking, then 'bake all dynamics' and the dummy frames stay put and the new bake goes in my scene directory without deleting on save. @brecht This is still a bit messy I guess, but maybe we could have a kind of 'fake bake' checkbox to achieve this trick somehow. Might solve a lot of hassle till the system gets a rejig. Cheers.
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 project
No Assignees
6 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#36382
No description provided.