Add versioning code to make particles with default size visible again

Due to changes in draw code particles from old files that may have had a
default draw size of 0 will not be visible. Old draw code would check
for this and adjust the size, however the unit for draw size has changed
from pixels to BU, and it no longer makes sense to have such checks.

This patch is to ensure particles from such files remain visible.
This commit is contained in:
Mai Lavelle 2018-02-06 22:55:15 -05:00
parent ca7f826c6f
commit c98af0faaf
2 changed files with 13 additions and 1 deletions

View File

@ -546,6 +546,18 @@ void do_versions_after_linking_280(Main *main)
}
}
if (!MAIN_VERSION_ATLEAST(main, 280, 3)) {
/* Due to several changes to particle RNA and draw code particles from older files may no longer
* be visible. Here we correct this by setting a default draw size for those files. */
for (Object *object = main->object.first; object; object = object->id.next) {
for (ParticleSystem *psys = object->particlesystem.first; psys; psys=psys->next) {
if(psys->part->draw_size == 0.0f) {
psys->part->draw_size = 0.1f;
}
}
}
}
{
for (WorkSpace *workspace = main->workspaces.first; workspace; workspace = workspace->id.next) {
if (workspace->view_layer) {

View File

@ -2382,7 +2382,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_range(prop, 0, 100, 1, -1);
RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU (0.1 = default)");
RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);