diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-12-20 19:35:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-12-20 19:35:27 +0300 |
commit | 0f2b2e3c60173e85e137df71392d867576e65ac1 (patch) | |
tree | f06099e4ef4a673b622a9f61902cb7b57692780a /source/blender/src | |
parent | 2e48a4af57759e61a1afd89edb19a4dc92ced728 (diff) |
Strand Render Simplification
============================
- Strand render now has options to remove child strands as
the object's faces becomes smaller, in the Simplification
particle panel.
- "Reference Size" is the approximate size of the object on
screen, after which simplification starts.
- "Rate" is how fast strands are removed.
- "Transition" is the percentage of strands being faded out as
they are removed.
- Another "Viewport" option removes strands on faces that are
outside of the viewport. "Rate" again controls how fast these
are removed.
- Strand render in Blender Units now has an adjustable minimum
width. Below this minimum width, strands start fading out
instead of getting smaller.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/buttons_object.c | 44 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 34 |
2 files changed, 63 insertions, 15 deletions
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 3c2969e77bf..e5bb4dd8a10 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -3610,8 +3610,8 @@ static void object_panel_particle_children(Object *ob) if(part==NULL) return; block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_child", UI_EMBOSS, UI_HELV, curarea->win); - uiNewPanelTabbed("Extras", "Particle"); if(uiNewPanel(curarea, block, "Children", "Particle", 1300, 0, 318, 204)==0) return; + uiNewPanelTabbed("Extras", "Particle"); uiDefButS(block, MENU, B_PART_ALLOC_CHILD, "Children from:%t|Faces%x2|Particles%x1|None%x0", butx,buty,butw,buth, &part->childtype, 14.0, 0.0, 0, 0, "Create child particles"); @@ -3957,6 +3957,47 @@ static void object_panel_particle_visual(Object *ob) } uiBlockEndAlign(block); } +static void object_panel_particle_simplification(Object *ob) +{ + uiBlock *block; + ParticleSystem *psys=psys_get_current(ob); + ParticleSettings *part; + short butx=0, buty=160, butw=150, buth=20; + + if (psys==NULL) return; + part=psys->part; + if(part==NULL) return; + + if(part->draw_as!=PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND)) + return; + if(part->childtype!=PART_CHILD_FACES) + return; + + block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_simplification", UI_EMBOSS, UI_HELV, curarea->win); + uiNewPanelTabbed("Visualization", "Particle"); + if(uiNewPanel(curarea, block, "Simplification", "Particle", 640, 0, 318, 204)==0) return; + + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, PART_SIMPLIFY_ENABLE, B_PART_REDRAW, "Child Simplification", butx,buty-=buth,butw,buth, &part->simplify_flag, 0, 0, 0, 0, "Remove child strands as the object becomes smaller on the screen"); + uiBlockEndAlign(block); + if(part->simplify_flag & PART_SIMPLIFY_ENABLE) { + buty -= 10; + + uiBlockBeginAlign(block); + uiDefButS(block, NUM, B_NOP, "Reference Size:", butx,(buty-=buth),butw,buth, &part->simplify_refsize, 1.0, 32768.0, 0, 0, "Reference size size in pixels, after which simplification begins"); + uiDefButF(block, NUM, B_NOP, "Rate:", butx,(buty-=buth),butw,buth, &part->simplify_rate, 0.0, 1.0, 0, 0, "Speed of simplification"); + uiDefButF(block, NUM, B_NOP, "Transition:", butx,(buty-=buth),butw,buth, &part->simplify_transition, 0.0, 1.0, 0, 0, "Transition period for fading out strands"); + uiBlockEndAlign(block); + + buty -= 10; + + uiBlockBeginAlign(block); + uiDefButBitS(block, TOG, PART_SIMPLIFY_VIEWPORT, B_PART_REDRAW, "Viewport", butx,buty-=buth,butw,buth, &part->simplify_flag, 0, 0, 0, 0, "Remove child strands as the object goes outside the viewport"); + uiDefButF(block, NUM, B_NOP, "Rate:", butx,(buty-=buth),butw,buth, &part->simplify_viewport, 0.0, 0.999, 0, 0, "Speed of simplification"); + uiBlockEndAlign(block); + } + uiBlockEndAlign(block); +} static void boidrule_moveDown(void *part_v, void *rule_v) { ParticleSettings *part = part_v; @@ -4700,6 +4741,7 @@ void particle_panels() if(psys){ object_panel_particle_physics(ob); object_panel_particle_visual(ob); + object_panel_particle_simplification(ob); object_panel_particle_extra(ob); object_panel_particle_children(ob); } diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index dafd156524f..ad1afcc0608 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -3852,31 +3852,37 @@ static uiBlock *strand_menu(void *mat_v) { Material *ma= mat_v; uiBlock *block; + int buth=20, butw=230, butx=10, buty=160; block= uiNewBlock(&curarea->uiblocks, "strand menu", UI_EMBOSS, UI_HELV, curarea->win); - + + if(ma->mode & MA_STR_B_UNITS) + buty += buth; + /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", 0, 0, 250, 170, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "", 0, 0, butw+20, buty+10, NULL, 0, 0, 0, 0, ""); + /* event return 0, to prevent menu to close */ uiBlockBeginAlign(block); - /* event return 0, to prevent menu to close */ - - uiDefButBitI(block, TOG, MA_TANGENT_STR, 0, "Use Tangent Shading", 10,140,230,20, &(ma->mode), 0, 0, 0, 0, "Uses direction of strands as normal for tangent-shading"); - uiDefButBitI(block, TOG, MA_STR_SURFDIFF, 0, "Surface Diffuse", 10,120,115,20, &(ma->mode), 0, 0, 0, 0, "Make diffuse shading more similar to shading the surface"); - uiDefButF(block, NUM, 0, "Dist", 125,120,115,20, &ma->strand_surfnor, 0.0f, 10.0f, 2, 0, "Distance in Blender units over which to blend in the surface normal"); + uiDefButBitI(block, TOG, MA_TANGENT_STR, 0, "Use Tangent Shading", butx,buty-=buth,butw,buth, &(ma->mode), 0, 0, 0, 0, "Uses direction of strands as normal for tangent-shading"); + uiDefButBitI(block, TOG, MA_STR_SURFDIFF, 0, "Surface Diffuse", butx,buty-=buth,butw/2,buth, &(ma->mode), 0, 0, 0, 0, "Make diffuse shading more similar to shading the surface"); + uiDefButF(block, NUM, 0, "Dist", butx+butw/2,buty,butw/2,buth, &ma->strand_surfnor, 0.0f, 10.0f, 2, 0, "Distance in Blender units over which to blend in the surface normal"); + + buty -= 5; uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, MA_STR_B_UNITS, 0, "Use Blender Units", 10,95,230,20, &(ma->mode), 0, 0, 0, 0, "Use actual Blender units for widths instead of pixels"); + uiDefButBitI(block, TOG, MA_STR_B_UNITS, 0, "Use Blender Units", butx,buty-=buth,butw,buth, &(ma->mode), 0, 0, 0, 0, "Use actual Blender units for widths instead of pixels"); if(ma->mode & MA_STR_B_UNITS){ - uiDefButF(block, NUMSLI, 0, "Start ", 10, 75, 230,20, &ma->strand_sta, 0.0001, 2.0, 2, 0, "Start size of strands in Blender units"); - uiDefButF(block, NUMSLI, 0, "End ", 10, 55, 230,20, &ma->strand_end, 0.0001, 1.0, 2, 0, "End size of strands in Blender units"); + uiDefButF(block, NUMSLI, 0, "Start ", butx,buty-=buth, butw,buth, &ma->strand_sta, 0.0001, 2.0, 2, 0, "Start size of strands in Blender units"); + uiDefButF(block, NUMSLI, 0, "End ", butx,buty-=buth, butw,buth, &ma->strand_end, 0.0001, 1.0, 2, 0, "End size of strands in Blender units"); + uiDefButF(block, NUMSLI, 0, "Minimum ", butx,buty-=buth, butw,buth, &ma->strand_min, 0.001, 10.0, 0, 0, "Minimum size of strands in pixels"); } else{ - uiDefButF(block, NUMSLI, 0, "Start ", 10, 75, 230,20, &ma->strand_sta, 0.25, 20.0, 2, 0, "Start size of strands in pixels"); - uiDefButF(block, NUMSLI, 0, "End ", 10, 55, 230,20, &ma->strand_end, 0.25, 10.0, 2, 0, "End size of strands in pixels"); + uiDefButF(block, NUMSLI, 0, "Start ", butx,buty-=buth, butw,buth, &ma->strand_sta, 0.25, 20.0, 2, 0, "Start size of strands in pixels"); + uiDefButF(block, NUMSLI, 0, "End ", butx,buty-=buth, butw,buth, &ma->strand_end, 0.25, 10.0, 2, 0, "End size of strands in pixels"); } - uiDefButF(block, NUMSLI, 0, "Shape ", 10, 35, 230,20, &ma->strand_ease, -0.9, 0.9, 2, 0, "Shape of strands, positive value makes it rounder, negative makes it spiky"); - uiDefBut(block, TEX, B_MATPRV, "UV:", 10,10,230,20, ma->strand_uvname, 0, 31, 0, 0, "Set name of UV layer to override"); + uiDefButF(block, NUMSLI, 0, "Shape ", butx,buty-=buth, butw,buth, &ma->strand_ease, -0.9, 0.9, 2, 0, "Shape of strands, positive value makes it rounder, negative makes it spiky"); + uiDefBut(block, TEX, B_MATPRV, "UV:", butx,buty-=buth,butw,buth, ma->strand_uvname, 0, 31, 0, 0, "Set name of UV layer to override"); uiBlockSetDirection(block, UI_TOP); BIF_preview_changed(ID_MA); |