[Bf-blender-cvs] [2b730763a3a] blender2.8: Particles: Hair: Make hair selectable in the 3D view.
Clément Foucault
noreply at git.blender.org
Tue Apr 17 17:34:26 CEST 2018
Commit: 2b730763a3ae359c3af972b7f3b76e080e4ba43d
Author: Clément Foucault
Date: Tue Apr 17 17:34:00 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB2b730763a3ae359c3af972b7f3b76e080e4ba43d
Particles: Hair: Make hair selectable in the 3D view.
===================================================================
M source/blender/draw/engines/basic/basic_engine.c
===================================================================
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index 171b9111bac..2e0a0881928 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -31,6 +31,9 @@
#include "BKE_icons.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
+#include "BKE_particle.h"
+
+#include "DNA_particle_types.h"
#include "GPU_shader.h"
@@ -81,6 +84,7 @@ typedef struct BASIC_PrivateData {
#ifdef USE_DEPTH
DRWShadingGroup *depth_shgrp;
DRWShadingGroup *depth_shgrp_cull;
+ DRWShadingGroup *depth_shgrp_hair;
#endif
DRWShadingGroup *color_shgrp;
} BASIC_PrivateData; /* Transient data */
@@ -115,7 +119,7 @@ static void basic_cache_init(void *vedata)
#ifdef USE_DEPTH
/* Depth Pass */
{
- psl->depth_pass = DRW_pass_create("Depth Pass", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
+ psl->depth_pass = DRW_pass_create("Depth Pass", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_WIRE);
stl->g_data->depth_shgrp = DRW_shgroup_create(e_data.depth_sh, psl->depth_pass);
psl->depth_pass_cull = DRW_pass_create(
@@ -139,6 +143,26 @@ static void basic_cache_populate(void *vedata, Object *ob)
if (!DRW_object_is_renderable(ob))
return;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+
+ if (ob != draw_ctx->object_edit) {
+ for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
+ if (psys_check_enabled(ob, psys, false)) {
+ ParticleSettings *part = psys->part;
+ int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
+
+ if (draw_as == PART_DRAW_PATH && !psys->pathcache && !psys->childcache) {
+ draw_as = PART_DRAW_DOT;
+ }
+
+ if (draw_as == PART_DRAW_PATH) {
+ struct Gwn_Batch *hairs = DRW_cache_particles_get_hair(psys, NULL);
+ DRW_shgroup_call_add(stl->g_data->depth_shgrp, hairs, NULL);
+ }
+ }
+ }
+ }
+
struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
bool do_cull = false; /* TODO (we probably wan't to take this from the viewport?) */
More information about the Bf-blender-cvs
mailing list