[Bf-blender-cvs] [3b311b7cb23] blender2.8: Fix uninit shading group in object mode particles

Luca Rood noreply at git.blender.org
Fri May 26 13:36:34 CEST 2017


Commit: 3b311b7cb2320cc7a86f23c6d5ffa0747a045818
Author: Luca Rood
Date:   Fri May 26 13:35:45 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB3b311b7cb2320cc7a86f23c6d5ffa0747a045818

Fix uninit shading group in object mode particles

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

M	source/blender/draw/modes/object_mode.c

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

diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index e9f364eee21..24f3e1e54b6 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1418,7 +1418,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
 
 					if (draw_as != PART_DRAW_PATH) {
 						struct Batch *geom = DRW_cache_particles_get_dots(psys);
-						DRWShadingGroup *shgrp;
+						DRWShadingGroup *shgrp = NULL;
 						static int screen_space[2] = {0, 1};
 						static float def_prim_col[3] = {0.5f, 0.5f, 0.5f};
 						static float def_sec_col[3] = {1.0f, 1.0f, 1.0f};
@@ -1454,13 +1454,15 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
 								break;
 						}
 
-						if (draw_as != PART_DRAW_DOT) {
-							DRW_shgroup_attrib_float(shgrp, "pos", 3);
-							DRW_shgroup_attrib_float(shgrp, "rot", 4);
-							DRW_shgroup_attrib_float(shgrp, "val", 1);
-							DRW_shgroup_uniform_short_to_int(shgrp, "draw_size", &part->draw_size, 1);
-							DRW_shgroup_uniform_float(shgrp, "pixel_size", DRW_viewport_pixelsize_get(), 1);
-							DRW_shgroup_instance_batch(shgrp, geom);
+						if (shgrp) {
+							if (draw_as != PART_DRAW_DOT) {
+								DRW_shgroup_attrib_float(shgrp, "pos", 3);
+								DRW_shgroup_attrib_float(shgrp, "rot", 4);
+								DRW_shgroup_attrib_float(shgrp, "val", 1);
+								DRW_shgroup_uniform_short_to_int(shgrp, "draw_size", &part->draw_size, 1);
+								DRW_shgroup_uniform_float(shgrp, "pixel_size", DRW_viewport_pixelsize_get(), 1);
+								DRW_shgroup_instance_batch(shgrp, geom);
+							}
 						}
 					}
 				}




More information about the Bf-blender-cvs mailing list