[Bf-blender-cvs] [c98af0faaf0] blender2.8: Add versioning code to make particles with default size visible again

Mai Lavelle noreply at git.blender.org
Thu Feb 15 09:37:42 CET 2018


Commit: c98af0faaf0d2dc87e9c0007e6fab8f44c2ba608
Author: Mai Lavelle
Date:   Tue Feb 6 22:55:15 2018 -0500
Branches: blender2.8
https://developer.blender.org/rBc98af0faaf0d2dc87e9c0007e6fab8f44c2ba608

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.

===================================================================

M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/makesrna/intern/rna_particle.c

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 93c6a9cccba..46021a8b502 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -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) {
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 1064b9f00f0..1a819c3bcdb 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -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);



More information about the Bf-blender-cvs mailing list