diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index d9b66a67149..351a949946a 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -1053,6 +1053,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel): row = layout.row() row.prop(part, "draw_method", expand=True) + row.prop(part, "show_guide_hairs") if part.draw_method == 'NONE' or (part.render_type == 'NONE' and part.draw_method == 'RENDER'): return diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 62c0358210f..ed2d5d2cf02 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3046,7 +3046,15 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) copy_v3_v3(ca->col, col); } - + + if (part->type == PART_HAIR) { + HairKey *hkey; + + for (k = 0, hkey = pa->hair; k < pa->totkey; ++k, ++hkey) { + mul_v3_m4v3(hkey->world_co, hairmat, hkey->co); + } + } + /*--modify paths and calculate rotation & velocity--*/ if (!(psys->flag & PSYS_GLOBAL_HAIR)) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e44012279b4..d42d56e614e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5159,6 +5159,34 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1); } } + + if (part->type == PART_HAIR) { + if (part->draw & PART_DRAW_GUIDE_HAIRS) { + glDisable(GL_LIGHTING); + glDisable(GL_COLOR_MATERIAL); + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + for (a = 0, pa = psys->particles; a < totpart; a++, pa++) { + if (pa->totkey > 1) { + HairKey *hkey = pa->hair; + + glVertexPointer(3, GL_FLOAT, sizeof(HairKey), hkey->world_co); + + // XXX use proper theme color here +// UI_ThemeColor(TH_NORMAL); + glColor3f(0.58f, 0.67f, 1.0f); + + glDrawArrays(GL_LINE_STRIP, 0, pa->totkey); + } + } + glEnable(GL_LIGHTING); + glEnable(GL_COLOR_MATERIAL); + glEnableClientState(GL_NORMAL_ARRAY); + if ((dflag & DRAW_CONSTCOLOR) == 0) + if (part->draw_col == PART_DRAW_COL_MAT) + glEnableClientState(GL_COLOR_ARRAY); + } + } /* draw child particles */ cache = psys->childcache; diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index dd25a49c476..90b0fab5073 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -44,6 +44,7 @@ typedef struct HairKey { float weight; /* softbody weight */ short editflag; /* saved particled edit mode flags */ short pad; + float world_co[3]; } HairKey; typedef struct ParticleKey { /* when changed update size of struct to copy_particleKey()!! */ @@ -313,6 +314,28 @@ typedef struct ParticleSystem { float _pad; /* spare capacity */ } ParticleSystem; +typedef enum eParticleDrawFlag { + PART_DRAW_VEL = (1 << 0), + PART_DRAW_GLOBAL_OB = (1 << 1), + PART_DRAW_SIZE = (1 << 2), + PART_DRAW_EMITTER = (1 << 3), /* render emitter also */ + PART_DRAW_HEALTH = (1 << 4), + PART_ABS_PATH_TIME = (1 << 5), + PART_DRAW_COUNT_GR = (1 << 6), + PART_DRAW_BB_LOCK = (1 << 7), /* used with billboards */ + PART_DRAW_ROTATE_OB = (1 << 7), /* used with dupliobjects/groups */ + PART_DRAW_PARENT = (1 << 8), + PART_DRAW_NUM = (1 << 9), + PART_DRAW_RAND_GR = (1 << 10), + PART_DRAW_REN_ADAPT = (1 << 11), + PART_DRAW_VEL_LENGTH = (1 << 12), + PART_DRAW_MAT_COL = (1 << 13), /* deprecated, but used in do_versions */ + PART_DRAW_WHOLE_GR = (1 << 14), + PART_DRAW_REN_STRAND = (1 << 15), + PART_DRAW_NO_SCALE_OB = (1 << 16), /* used with dupliobjects/groups */ + PART_DRAW_GUIDE_HAIRS = (1 << 17), +} eParticleDrawFlag; + /* part->type */ /* hair is allways baked static in object/geometry space */ /* other types (normal particles) are in global space and not static baked */ @@ -391,26 +414,6 @@ typedef struct ParticleSystem { #define PART_KINK_WAVE 3 #define PART_KINK_BRAID 4 -/* part->draw */ -#define PART_DRAW_VEL 1 -#define PART_DRAW_GLOBAL_OB 2 -#define PART_DRAW_SIZE 4 -#define PART_DRAW_EMITTER 8 /* render emitter also */ -#define PART_DRAW_HEALTH 16 -#define PART_ABS_PATH_TIME 32 -#define PART_DRAW_COUNT_GR 64 -#define PART_DRAW_BB_LOCK 128 /* used with billboards */ -#define PART_DRAW_ROTATE_OB 128 /* used with dupliobjects/groups */ -#define PART_DRAW_PARENT 256 -#define PART_DRAW_NUM 512 -#define PART_DRAW_RAND_GR 1024 -#define PART_DRAW_REN_ADAPT 2048 -#define PART_DRAW_VEL_LENGTH (1<<12) -#define PART_DRAW_MAT_COL (1<<13) /* deprecated, but used in do_versions */ -#define PART_DRAW_WHOLE_GR (1<<14) -#define PART_DRAW_REN_STRAND (1<<15) -#define PART_DRAW_NO_SCALE_OB (1<<16) /* used with dupliobjects/groups */ - /* part->draw_col */ #define PART_DRAW_COL_NONE 0 #define PART_DRAW_COL_MAT 1 diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index b12cc85c6e4..1fa9785397c 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -2177,6 +2177,11 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_reset"); /*draw flag*/ + prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS); + RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL); RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");