Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-20 22:49:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-10-20 22:49:21 +0400
commitd8ee1e27375b475e610bc04f2c7cf3efee0d6c1b (patch)
tree1b1d71aaa4e1a00d19b7a1389af415dc39df1340 /source/blender/editors/physics
parent022be64517b1d3f17d640fb9a1bafe4941e51e03 (diff)
Bugfix for a crash with the cut tool in particle mode.
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_edit.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 6fc34c4fcf8..be4df93eff3 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -2901,7 +2901,7 @@ static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int p
(data->edit->points + point_index)->flag |= PEP_EDIT_RECALC;
}
-static void brush_add(PEData *data, short number)
+static int brush_add(PEData *data, short number)
{
Scene *scene= data->scene;
Object *ob= data->ob;
@@ -2922,7 +2922,7 @@ static void brush_add(PEData *data, short number)
Mat4Invert(imat,ob->obmat);
if(psys->flag & PSYS_GLOBAL_HAIR)
- return;
+ return 0;
BLI_srandom(psys->seed+data->mval[0]+data->mval[1]);
@@ -3097,6 +3097,8 @@ static void brush_add(PEData *data, short number)
if(!psmd->dm->deformedOnly)
dm->release(dm);
+
+ return n;
}
/************************* brush edit operator ********************/
@@ -3147,7 +3149,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
ARegion *ar= CTX_wm_region(C);
float vec[3], mousef[2];
short mval[2], mvalo[2];
- int flip, mouse[2], dx, dy, removed= 0, selected= 0;
+ int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0;
int lock_root = pset->flag & PE_LOCK_FIRST;
if(!PE_start_edit(edit))
@@ -3225,6 +3227,9 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
if(pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
}
+ else
+ removed= 0;
+
break;
}
case PE_BRUSH_LENGTH:
@@ -3279,11 +3284,13 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
PE_set_view3d_data(C, &data);
data.mval= mval;
- brush_add(&data, brush->strength);
+ added= brush_add(&data, brush->strength);
if(pset->flag & PE_KEEP_LENGTHS)
recalc_lengths(edit);
}
+ else
+ added= 0;
break;
}
case PE_BRUSH_SMOOTH:
@@ -3314,13 +3321,15 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
if((pset->flag & PE_KEEP_LENGTHS)==0)
recalc_lengths(edit);
- if(pset->brushtype == PE_BRUSH_ADD || removed) {
- if(pset->brushtype == PE_BRUSH_ADD && (pset->flag & PE_X_MIRROR))
- PE_mirror_x(scene, ob, 1);
+ if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT)) {
+ if(added || removed) {
+ if(pset->brushtype == PE_BRUSH_ADD && (pset->flag & PE_X_MIRROR))
+ PE_mirror_x(scene, ob, 1);
- update_world_cos(ob,edit);
- psys_free_path_cache(NULL, edit);
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ update_world_cos(ob,edit);
+ psys_free_path_cache(NULL, edit);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ }
}
else
PE_update_object(scene, ob, 1);