johnroper100 / CrowdMaster

Crowd Simulation for the Masses
http://crowdmaster.org
GNU General Public License v3.0
133 stars 24 forks source link

Multiple node trees datablocks and multiple file saves, open and closes causes deletion of node tree datablocks without warning #30

Closed axb2035 closed 7 years ago

axb2035 commented 7 years ago

Background: Most datablocks will be not be saved if there are no users linked (see here: https://docs.blender.org/manual/en/dev/data_system/data_blocks.html).

Crowdmaster node tree datablocks with a User Count of 0 are not written on save and purged on exiting a Blender session effectively deleting them forever like most other data blocks. Note there is a previous issue raised that unlinking a datablock does not reduce the user count for that session only and so may still be saved (#29).

Issue: If you create multiple Sim and/or Gen datablocks they will all save because of issue #29 even if unlinked. When you close and reload the file only the Sim or Gen datablock(s) displayed will not have a User count of 0. Any node trees you load into the node editor will also be updated and not have a 0 next to their name in the nodetree browser list. Any unloaded node trees will have a 0 next to their name in the node tree browser list from the datablock and will not be saved and are purged on exit 💥 😱

Steps to recreate: Step 1: Create two Sim node trees and two Gen node trees. In the node tree browser list they will not have 0 next to their name. Leave one of the node trees displayed (I have used Brain 2 in this example) and save file. Exit blender.

image

image

Step 2: Reopen blender file. In the node tree browser list the displayed node tree will not have 0 next to it's name. All the other Sim and Gen node trees will have 0 next to their name. Save file and exit Blender.

image

image

Step 3: Reopen file. Displayed node tree will remain - all other node trees will have been deleted

image

image

Step 4: Hope you have a backup!!! 😰

Peter-Noble commented 7 years ago

"Solved" by automatically setting the fake user on newly created node trees when the file is saved.