diff options
author | Joseph Eagar <joeedh@gmail.com> | 2010-03-09 07:32:40 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2010-03-09 07:32:40 +0300 |
commit | 71003b9bcc88ecf6138c3debb9abba4637c8e61a (patch) | |
tree | 7f85d40231311a36a72f731a7c07b8dbd6fff577 /source/blender/editors/physics | |
parent | ea540496c8281dcba899fb6b29c1bcfbb53a0482 (diff) | |
parent | 790d6ca256e6b572826b2bf214c6fd6c8a623969 (diff) |
merge with trunk at r27259 and commit of a patch by anthony jones to fix msvc (though further work may be needed because changes made by the merge
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/particle_boids.c | 16 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 205 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 32 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 24 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 2 |
7 files changed, 231 insertions, 56 deletions
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index b7a97d1131a..e738aa34d07 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Janne Karhu. * All rights reserved. @@ -87,7 +87,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Boid Rule"; - ot->description = "Add a boid rule to the current boid state."; + ot->description = "Add a boid rule to the current boid state"; ot->idname= "BOID_OT_rule_add"; /* api callbacks */ @@ -97,7 +97,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", ""); } static int rule_del_exec(bContext *C, wmOperator *op) { @@ -178,7 +178,7 @@ static int rule_move_up_exec(bContext *C, wmOperator *op) void BOID_OT_rule_move_up(wmOperatorType *ot) { ot->name= "Move Up Boid Rule"; - ot->description= "Move boid rule up in the list."; + ot->description= "Move boid rule up in the list"; ot->idname= "BOID_OT_rule_move_up"; ot->exec= rule_move_up_exec; @@ -216,7 +216,7 @@ static int rule_move_down_exec(bContext *C, wmOperator *op) void BOID_OT_rule_move_down(wmOperatorType *ot) { ot->name= "Move Down Boid Rule"; - ot->description= "Move boid rule down in the list."; + ot->description= "Move boid rule down in the list"; ot->idname= "BOID_OT_rule_move_down"; ot->exec= rule_move_down_exec; @@ -257,7 +257,7 @@ void BOID_OT_state_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Boid State"; - ot->description = "Add a boid state to the particle system."; + ot->description = "Add a boid state to the particle system"; ot->idname= "BOID_OT_state_add"; /* api callbacks */ @@ -349,7 +349,7 @@ static int state_move_up_exec(bContext *C, wmOperator *op) void BOID_OT_state_move_up(wmOperatorType *ot) { ot->name= "Move Up Boid State"; - ot->description= "Move boid state up in the list."; + ot->description= "Move boid state up in the list"; ot->idname= "BOID_OT_state_move_up"; ot->exec= state_move_up_exec; @@ -385,7 +385,7 @@ static int state_move_down_exec(bContext *C, wmOperator *op) void BOID_OT_state_move_down(wmOperatorType *ot) { ot->name= "Move Down Boid State"; - ot->description= "Move boid state down in the list."; + ot->description= "Move boid state down in the list"; ot->idname= "BOID_OT_state_move_down"; ot->exec= state_move_down_exec; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 5ac843f796c..71c18b35365 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2007 by Janne Karhu. * All rights reserved. @@ -88,6 +88,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys); static void PTCacheUndo_clear(PTCacheEdit *edit); +static void recalc_emitter_field(Object *ob, ParticleSystem *psys); #define KEY_K PTCacheEditKey *key; int k #define POINT_P PTCacheEditPoint *point; int p @@ -190,10 +191,13 @@ int PE_start_edit(PTCacheEdit *edit) ParticleEditSettings *PE_settings(Scene *scene) { - return &scene->toolsettings->particle; + return scene->toolsettings ? &scene->toolsettings->particle : NULL; } -/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set */ +/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set + * + * note: this function runs on poll, therefor it can runs many times a second + * keep it fast! */ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) { ParticleEditSettings *pset= PE_settings(scene); @@ -201,12 +205,12 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) ListBase pidlist; PTCacheID *pid; + if(pset==NULL || ob==NULL) + return NULL; + pset->scene = scene; pset->object = ob; - if(ob==NULL) - return NULL; - BKE_ptcache_ids_from_object(&pidlist, ob); /* in the case of only one editable thing, set pset->edittype accordingly */ @@ -370,7 +374,8 @@ static void PE_set_view3d_data(bContext *C, PEData *data) PE_set_data(C, data); view3d_set_viewcontext(C, &data->vc); - view3d_get_transformation(data->vc.ar, data->vc.rv3d, data->ob, &data->mats); + /* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather then (obmat * viewmat) */ + view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats); if((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) view3d_validate_backbuf(&data->vc); @@ -403,7 +408,8 @@ static int key_test_depth(PEData *data, float co[3]) x+= (short)data->vc.ar->winrct.xmin; y+= (short)data->vc.ar->winrct.ymin; - view3d_validate_backbuf(&data->vc); + /* PE_set_view3d_data calls this. no need to call here */ + /* view3d_validate_backbuf(&data->vc); */ glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); if((float)uz - 0.0001 > depth) @@ -2362,6 +2368,52 @@ void PARTICLE_OT_remove_doubles(wmOperatorType *ot) RNA_def_float(ot->srna, "threshold", 0.0002f, 0.0f, FLT_MAX, "Threshold", "Threshold distance withing which particles are removed", 0.00001f, 0.1f); } + +static int weight_set_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + ParticleEditSettings *pset= PE_settings(scene); + Object *ob= CTX_data_active_object(C); + PTCacheEdit *edit= PE_get_current(scene, ob); + ParticleSystem *psys = edit->psys; + POINT_P; + KEY_K; + HairKey *hkey; + float weight; + ParticleBrushData *brush= &pset->brush[pset->brushtype]; + edit= psys->edit; + + weight= (float)(brush->strength / 100.0f); + + LOOP_SELECTED_POINTS { + ParticleData *pa= psys->particles + p; + + LOOP_SELECTED_KEYS { + hkey= pa->hair + k; + hkey->weight= weight; + } + } + + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, ob); + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_weight_set(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Weight Set"; + ot->idname= "PARTICLE_OT_weight_set"; + + /* api callbacks */ + ot->exec= weight_set_exec; + ot->poll= PE_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /************************ cursor drawing *******************************/ static void brush_drawcursor(bContext *C, int x, int y, void *customdata) @@ -2536,7 +2588,7 @@ void PARTICLE_OT_delete(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "type", delete_type_items, DEL_PARTICLE, "Type", "Delete a full particle or only keys."); + ot->prop= RNA_def_enum(ot->srna, "type", delete_type_items, DEL_PARTICLE, "Type", "Delete a full particle or only keys."); } /*************************** mirror operator **************************/ @@ -2840,7 +2892,16 @@ static void brush_puff(PEData *data, int point_index) PTCacheEditPoint *point = edit->points + point_index; KEY_K; float mat[4][4], imat[4][4]; - float lastco[3], rootco[3] = {0.0f, 0.0f, 0.0f}, co[3], nor[3], kco[3], dco[3], fac=0.0f, length=0.0f; + + float lastco[3], rootco[3] = {0.0f, 0.0f, 0.0f}, co[3], nor[3], kco[3], dco[3], ofs[3] = {0.0f, 0.0f, 0.0f}, fac=0.0f, length=0.0f; + int puff_volume = 0; + int change= 0; + + { + ParticleEditSettings *pset= PE_settings(data->scene); + ParticleBrushData *brush= &pset->brush[pset->brushtype]; + puff_volume = brush->flag & PE_BRUSH_DATA_PUFF_VOLUME; + } if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) { psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, psys->particles + point_index, mat); @@ -2856,12 +2917,15 @@ static void brush_puff(PEData *data, int point_index) /* find root coordinate and normal on emitter */ VECCOPY(co, key->co); mul_m4_v3(mat, co); + mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */ - point_index= BLI_kdtree_find_nearest(edit->emitter_field, co, NULL, NULL); + point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL); if(point_index == -1) return; VECCOPY(rootco, co); copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]); + mul_mat3_m4_v3(data->ob->obmat, nor); /* normal into worldspace */ + normalize_v3(nor); length= 0.0f; @@ -2871,24 +2935,101 @@ static void brush_puff(PEData *data, int point_index) fac= -fac; } else { - /* compute position as if hair was standing up straight */ + /* compute position as if hair was standing up straight. + * */ VECCOPY(lastco, co); VECCOPY(co, key->co); mul_m4_v3(mat, co); length += len_v3v3(lastco, co); + if((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE)) { + VECADDFAC(kco, rootco, nor, length); - VECADDFAC(kco, rootco, nor, length); + /* blend between the current and straight position */ + VECSUB(dco, kco, co); + VECADDFAC(co, co, dco, fac); - /* blend between the current and straight position */ - VECSUB(dco, kco, co); - VECADDFAC(co, co, dco, fac); + /* re-use dco to compare before and after translation and add to the offset */ + VECCOPY(dco, key->co); + + mul_v3_m4v3(key->co, imat, co); + + if(puff_volume) { + /* accumulate the total distance moved to apply to unselected + * keys that come after */ + ofs[0] += key->co[0] - dco[0]; + ofs[1] += key->co[1] - dco[1]; + ofs[2] += key->co[2] - dco[2]; + } + change = 1; + } + else { - VECCOPY(key->co, co); - mul_m4_v3(imat, key->co); + if(puff_volume) { +#if 0 + /* this is simple but looks bad, adds annoying kinks */ + add_v3_v3(key->co, ofs); +#else + /* translate (not rotate) the rest of the hair if its not selected */ + if(ofs[0] || ofs[1] || ofs[2]) { +#if 0 /* kindof works but looks worse then whats below */ + + /* Move the unselected point on a vector based on the + * hair direction and the offset */ + float c1[3], c2[3]; + VECSUB(dco, lastco, co); + mul_mat3_m4_v3(imat, dco); /* into particle space */ + + /* move the point allong a vector perpendicular to the + * hairs direction, reduces odd kinks, */ + cross_v3_v3v3(c1, ofs, dco); + cross_v3_v3v3(c2, c1, dco); + normalize_v3(c2); + mul_v3_fl(c2, len_v3(ofs)); + add_v3_v3(key->co, c2); +#else + /* Move the unselected point on a vector based on the + * the normal of the closest geometry */ + float oco[3], onor[3]; + VECCOPY(oco, key->co); + mul_m4_v3(mat, oco); + mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */ + + point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL); + if(point_index != -1) { + copy_v3_v3(onor, &edit->emitter_cosnos[point_index*6+3]); + mul_mat3_m4_v3(data->ob->obmat, onor); /* normal into worldspace */ + mul_mat3_m4_v3(imat, onor); /* worldspace into particle space */ + normalize_v3(onor); + + + mul_v3_fl(onor, len_v3(ofs)); + add_v3_v3(key->co, onor); + } +#endif + } +#endif + } + } } } - point->flag |= PEP_EDIT_RECALC; + if(change) + point->flag |= PEP_EDIT_RECALC; +} + + +static void brush_weight(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +{ + /* roots have full weight allways */ + if(key_index) { + PTCacheEdit *edit = data->edit; + ParticleSystem *psys = edit->psys; + + ParticleData *pa= psys->particles + point_index; + pa->hair[key_index].weight = data->weightfac; + + (data->edit->points + point_index)->flag |= PEP_EDIT_RECALC; + } } static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) @@ -3338,6 +3479,23 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) break; } + case PE_BRUSH_WEIGHT: + { + PEData data; + PE_set_view3d_data(C, &data); + + if(edit->psys) { + data.dm= psmd->dm; + data.mval= mval; + data.rad= (float)brush->size; + + data.weightfac = (float)(brush->strength / 100.0f); /* note that this will never be zero */ + + foreach_mouse_hit_key(&data, brush_weight, selected); + } + + break; + } } if((pset->flag & PE_KEEP_LENGTHS)==0) recalc_lengths(edit); @@ -3903,8 +4061,15 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { + PTCacheEdit *edit; ob->mode |= OB_MODE_PARTICLE_EDIT; - PE_create_current(scene, ob); + edit= PE_create_current(scene, ob); + + /* mesh may have changed since last entering editmode. + * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */ + if(edit && edit->psys) + recalc_emitter_field(ob, edit->psys); + toggle_particle_cursor(C, 1); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL); } diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 38ee11954e9..f590339b91d 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation. * All rights reserved. @@ -44,6 +44,7 @@ #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_cdderivedmesh.h" +#include "BKE_global.h" #include "BKE_main.h" #include "BKE_particle.h" #include "BKE_pointcache.h" @@ -81,7 +82,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot) /* identifiers */ ot->name= "Add Particle System Slot"; ot->idname= "OBJECT_OT_particle_system_add"; - ot->description="Add a particle system."; + ot->description="Add a particle system"; /* api callbacks */ ot->poll= ED_operator_object_active_editable; @@ -119,7 +120,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot) /* identifiers */ ot->name= "Remove Particle System Slot"; ot->idname= "OBJECT_OT_particle_system_remove"; - ot->description="Remove the selected particle system."; + ot->description="Remove the selected particle system"; /* api callbacks */ ot->poll= ED_operator_object_active_editable; @@ -178,7 +179,7 @@ void PARTICLE_OT_new(wmOperatorType *ot) /* identifiers */ ot->name= "New Particle Settings"; ot->idname= "PARTICLE_OT_new"; - ot->description="Add new particle settings."; + ot->description="Add new particle settings"; /* api callbacks */ ot->exec= new_particle_settings_exec; @@ -226,7 +227,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) /* identifiers */ ot->name= "New Particle Target"; ot->idname= "PARTICLE_OT_new_target"; - ot->description="Add a new particle target."; + ot->description="Add a new particle target"; /* api callbacks */ ot->exec= new_particle_target_exec; @@ -274,7 +275,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot) /* identifiers */ ot->name= "Remove Particle Target"; ot->idname= "PARTICLE_OT_target_remove"; - ot->description="Remove the selected particle target."; + ot->description="Remove the selected particle target"; /* api callbacks */ ot->exec= remove_particle_target_exec; @@ -314,7 +315,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot) { ot->name= "Move Up Target"; ot->idname= "PARTICLE_OT_target_move_up"; - ot->description= "Move particle target up in the list."; + ot->description= "Move particle target up in the list"; ot->exec= target_move_up_exec; @@ -352,7 +353,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot) { ot->name= "Move Down Target"; ot->idname= "PARTICLE_OT_target_move_down"; - ot->description= "Move particle target down in the list."; + ot->description= "Move particle target down in the list"; ot->exec= target_move_down_exec; @@ -390,7 +391,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot) { ot->name= "Move Up Dupli Object"; ot->idname= "PARTICLE_OT_dupliob_move_up"; - ot->description= "Move dupli object up in the list."; + ot->description= "Move dupli object up in the list"; ot->exec= dupliob_move_up_exec; @@ -430,7 +431,7 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot) /* identifiers */ ot->name= "Copy Particle Dupliob"; ot->idname= "PARTICLE_OT_dupliob_copy"; - ot->description="Duplicate the current dupliobject."; + ot->description="Duplicate the current dupliobject"; /* api callbacks */ ot->exec= copy_particle_dupliob_exec; @@ -473,7 +474,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot) /* identifiers */ ot->name= "Remove Particle Dupliobject"; ot->idname= "PARTICLE_OT_dupliob_remove"; - ot->description="Remove the selected dupliobject."; + ot->description="Remove the selected dupliobject"; /* api callbacks */ ot->exec= remove_particle_dupliob_exec; @@ -512,7 +513,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot) { ot->name= "Move Down Dupli Object"; ot->idname= "PARTICLE_OT_dupliob_move_down"; - ot->description= "Move dupli object down in the list."; + ot->description= "Move dupli object down in the list"; ot->exec= dupliob_move_down_exec; @@ -596,7 +597,7 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op) void PARTICLE_OT_disconnect_hair(wmOperatorType *ot) { ot->name= "Disconnect Hair"; - ot->description= "Disconnect hair from the emitter mesh."; + ot->description= "Disconnect hair from the emitter mesh"; ot->idname= "PARTICLE_OT_disconnect_hair"; ot->exec= disconnect_hair_exec; @@ -654,7 +655,8 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) BLI_bvhtree_find_nearest(bvhtree.tree, key->co, &nearest, bvhtree.nearest_callback, &bvhtree); if(nearest.index == -1) { - printf("No nearest point found for hair root!"); + if (G.f & G_DEBUG) + printf("No nearest point found for hair root!"); continue; } @@ -734,7 +736,7 @@ static int connect_hair_exec(bContext *C, wmOperator *op) void PARTICLE_OT_connect_hair(wmOperatorType *ot) { ot->name= "Connect Hair"; - ot->description= "Connect hair to the emitter mesh."; + ot->description= "Connect hair to the emitter mesh"; ot->idname= "PARTICLE_OT_connect_hair"; ot->exec= connect_hair_exec; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index eec971e777e..65701f89c4e 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) Blender Foundation * All rights reserved. @@ -109,9 +109,9 @@ static void *thread_tls_data; /* XXX */ /* from header info.c */ static int start_progress_bar(void) {return 0;}; -static void end_progress_bar(void) {}; +static void end_progress_bar(wmWindow *win) {WM_cursor_restore(win);}; static void waitcursor(int val) {}; -static int progress_bar(float done, char *busy_info) {return 0;} +static int progress_bar(wmWindow *win, float done, char *busy_info) { WM_timecursor(win,done*100); return 0;} static int pupmenu() {return 0;} /* XXX */ @@ -1060,7 +1060,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob) { int done = 0; float noFramesf = (float)noFrames; - float percentdone = 0.0; + float percentdone = 0.0, oldpercentdone = -1.0; int lastRedraw = -1; g_break= 0; @@ -1075,11 +1075,15 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob) // lukep we add progress bar as an interim mesure percentdone = globalBakeFrame / noFramesf; - sprintf(busy_mess, "baking fluids %d / %d |||", globalBakeFrame, (int) noFramesf); - progress_bar(percentdone, busy_mess ); + if (percentdone != oldpercentdone) { + sprintf(busy_mess, "baking fluids %d / %d |||", globalBakeFrame, (int) noFramesf); + percentdone = percentdone < 0.0 ? 0.0:percentdone; + progress_bar(CTX_wm_window(C), percentdone, busy_mess ); + oldpercentdone = percentdone; + } - // longer delay to prevent frequent redrawing - PIL_sleep_ms(2000); + //XXX no more need for longer delay to prevent frequent redrawing + PIL_sleep_ms(200); BLI_lock_thread(LOCK_CUSTOM1); if(globalBakeState != 0) done = 1; // 1=ok, <0=error/abort @@ -1121,7 +1125,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob) #endif } // redraw } - end_progress_bar(); + end_progress_bar(CTX_wm_window(C)); } BLI_end_threads(&threads); } // El'Beem API init, thread creation @@ -1213,7 +1217,7 @@ void FLUID_OT_bake(wmOperatorType *ot) { /* identifiers */ ot->name= "Fluid Simulation Bake"; - ot->description= "Bake fluid simulation."; + ot->description= "Bake fluid simulation"; ot->idname= "FLUID_OT_bake"; /* api callbacks */ diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index cc0a288f8be..aa3a2e22e31 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2007 by Janne Karhu. * All rights reserved. @@ -50,6 +50,7 @@ void PARTICLE_OT_reveal(struct wmOperatorType *ot); void PARTICLE_OT_rekey(struct wmOperatorType *ot); void PARTICLE_OT_subdivide(struct wmOperatorType *ot); void PARTICLE_OT_remove_doubles(struct wmOperatorType *ot); +void PARTICLE_OT_weight_set(struct wmOperatorType *ot); void PARTICLE_OT_delete(struct wmOperatorType *ot); void PARTICLE_OT_mirror(struct wmOperatorType *ot); diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 5cb8230e463..55568c89e75 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2009 Blender Foundation. * All rights reserved. @@ -57,6 +57,7 @@ static void operatortypes_particle(void) WM_operatortype_append(PARTICLE_OT_rekey); WM_operatortype_append(PARTICLE_OT_subdivide); WM_operatortype_append(PARTICLE_OT_remove_doubles); + WM_operatortype_append(PARTICLE_OT_weight_set); WM_operatortype_append(PARTICLE_OT_delete); WM_operatortype_append(PARTICLE_OT_mirror); @@ -111,6 +112,8 @@ static void keymap_particle(wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0); + + WM_keymap_add_item(keymap, "PARTICLE_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0); ED_object_generic_keymap(keyconf, keymap, 1); } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 0cd4c2e6ce8..1359af5377f 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2007 by Janne Karhu. * All rights reserved. |