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:
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r--source/blender/editors/physics/particle_edit.c192
1 files changed, 96 insertions, 96 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index c05bf4f7dea..2a15fb21fb8 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -92,7 +92,7 @@ int PE_poll(bContext *C)
if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
return 0;
-
+
return (PE_get_current(scene, ob) != NULL);
}
@@ -104,7 +104,7 @@ int PE_hair_poll(bContext *C)
if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
return 0;
-
+
edit= PE_get_current(scene, ob);
return (edit && edit->psys);
@@ -179,7 +179,7 @@ static float pe_brush_size_get(const Scene *UNUSED(scene), ParticleBrushData *br
// here we can enable unified brush size, needs more work...
// UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
// float size = (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size;
-
+
return brush->size * U.pixelsize;
}
@@ -320,7 +320,7 @@ static int pe_x_mirror(Object *ob)
{
if (ob->type == OB_MESH)
return (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X);
-
+
return 0;
}
@@ -329,7 +329,7 @@ static int pe_x_mirror(Object *ob)
typedef struct PEData {
ViewContext vc;
bglMats mats;
-
+
Scene *scene;
Object *ob;
DerivedMesh *dm;
@@ -394,13 +394,13 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
static bool PE_create_shape_tree(PEData *data, Object *shapeob)
{
DerivedMesh *dm = shapeob->derivedFinal;
-
+
memset(&data->shape_bvh, 0, sizeof(data->shape_bvh));
-
+
if (!dm) {
return false;
}
-
+
return (bvhtree_from_mesh_get(&data->shape_bvh, dm, BVHTREE_FROM_LOOPTRI, 4) != NULL);
}
@@ -472,7 +472,7 @@ static bool key_inside_circle(PEData *data, float rad, const float co[3], float
return 1;
}
-
+
return 0;
}
@@ -511,7 +511,7 @@ static bool point_is_selected(PTCacheEditPoint *point)
LOOP_SELECTED_KEYS {
return 1;
}
-
+
return 0;
}
@@ -756,7 +756,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
/* lookup particles and set in mirror cache */
if (!edit->mirror_cache)
edit->mirror_cache= MEM_callocN(sizeof(int)*totpart, "PE mirror cache");
-
+
LOOP_PARTICLES {
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm_final, psys->part->from, pa, mat);
@@ -801,7 +801,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
if (!mpa) {
if (!edit->mirror_cache)
PE_update_mirror_cache(ob, psys);
-
+
if (!edit->mirror_cache)
return; /* something went wrong! */
@@ -927,7 +927,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
LOOP_EDITED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm_final, psys->part->from, psys->particles + p, hairmat);
-
+
LOOP_KEYS {
mul_m4_v3(hairmat, key->co);
}
@@ -939,7 +939,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
}
else {
index= BLI_kdtree_find_nearest(edit->emitter_field, key->co, NULL);
-
+
vec=edit->emitter_cosnos +index*6;
nor=vec+3;
@@ -964,7 +964,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
dist_1st*=1.3333f;
}
}
-
+
invert_m4_m4(hairimat, hairmat);
LOOP_KEYS {
@@ -975,7 +975,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
/* force set distances between neighboring keys */
static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
{
-
+
ParticleEditSettings *pset=PE_settings(scene);
POINT_P; KEY_K;
float dv1[3];
@@ -1114,7 +1114,7 @@ void recalc_emitter_field(Object *ob, ParticleSystem *psys)
mvert=dm->getVertData(dm, mface->v4, CD_MVERT);
add_v3_v3v3(vec, vec, mvert->co);
VECADD(nor, nor, mvert->no);
-
+
mul_v3_fl(vec, 0.25);
}
else
@@ -1139,7 +1139,7 @@ static void PE_update_selection(Scene *scene, Object *ob, int useflag)
LOOP_POINTS
point->flag |= PEP_EDIT_RECALC;
- /* flush edit key flag to hair key flag to preserve selection
+ /* flush edit key flag to hair key flag to preserve selection
* on save */
if (edit->psys) LOOP_POINTS {
hkey = edit->psys->particles[p].hair;
@@ -1224,7 +1224,7 @@ static void update_velocities(PTCacheEdit *edit)
}
else {
dfra = *(key+1)->time - *(key-1)->time;
-
+
if (dfra <= 0.0f)
continue;
@@ -1411,7 +1411,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot)
ot->name = "(De)select All";
ot->idname = "PARTICLE_OT_select_all";
ot->description = "(De)select all particles' keys";
-
+
/* api callbacks */
ot->exec = pe_select_all_exec;
ot->poll = PE_poll;
@@ -1431,7 +1431,7 @@ int PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool deselec
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
-
+
if (!PE_start_edit(edit))
return OPERATOR_CANCELLED;
@@ -1471,7 +1471,7 @@ static void select_root(PEData *data, int point_index)
if (point->flag & PEP_HIDE)
return;
-
+
if (data->select_action != SEL_TOGGLE)
select_action_apply(point, key, data->select_action);
else if (key->flag & PEK_SELECT)
@@ -1509,7 +1509,7 @@ void PARTICLE_OT_select_roots(wmOperatorType *ot)
ot->name = "Select Roots";
ot->idname = "PARTICLE_OT_select_roots";
ot->description = "Select roots of all visible particles";
-
+
/* api callbacks */
ot->exec = select_roots_exec;
ot->poll = PE_poll;
@@ -1533,10 +1533,10 @@ static void select_tip(PEData *data, int point_index)
}
key = &point->keys[point->totkey - 1];
-
+
if (point->flag & PEP_HIDE)
return;
-
+
if (data->select_action != SEL_TOGGLE)
select_action_apply(point, key, data->select_action);
else if (key->flag & PEK_SELECT)
@@ -1708,7 +1708,7 @@ void PARTICLE_OT_select_linked(wmOperatorType *ot)
ot->name = "Select Linked";
ot->idname = "PARTICLE_OT_select_linked";
ot->description = "Select nearest particle from mouse pointer";
-
+
/* api callbacks */
ot->exec = select_linked_exec;
ot->invoke = select_linked_invoke;
@@ -1881,7 +1881,7 @@ static int hide_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
-
+
if (RNA_enum_get(op->ptr, "unselected")) {
LOOP_UNSELECTED_POINTS {
point->flag |= PEP_HIDE;
@@ -1913,7 +1913,7 @@ void PARTICLE_OT_hide(wmOperatorType *ot)
ot->name = "Hide Selected";
ot->idname = "PARTICLE_OT_hide";
ot->description = "Hide selected particles";
-
+
/* api callbacks */
ot->exec = hide_exec;
ot->poll = PE_poll;
@@ -1958,7 +1958,7 @@ void PARTICLE_OT_reveal(wmOperatorType *ot)
ot->name = "Reveal";
ot->idname = "PARTICLE_OT_reveal";
ot->description = "Show hidden particles";
-
+
/* api callbacks */
ot->exec = reveal_exec;
ot->poll = PE_poll;
@@ -2020,7 +2020,7 @@ void PARTICLE_OT_select_less(wmOperatorType *ot)
ot->name = "Select Less";
ot->idname = "PARTICLE_OT_select_less";
ot->description = "Deselect boundary selected keys of each particle";
-
+
/* api callbacks */
ot->exec = select_less_exec;
ot->poll = PE_poll;
@@ -2082,7 +2082,7 @@ void PARTICLE_OT_select_more(wmOperatorType *ot)
ot->name = "Select More";
ot->idname = "PARTICLE_OT_select_more";
ot->description = "Select keys linked to boundary selected keys of each particle";
-
+
/* api callbacks */
ot->exec = select_more_exec;
ot->poll = PE_poll;
@@ -2142,7 +2142,7 @@ static void rekey_particle(PEData *data, int pa_index)
if (point->keys)
MEM_freeN(point->keys);
ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey), "Hair re-key edit keys");
-
+
for (k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
ekey->co= key->co;
ekey->time= &key->time;
@@ -2165,7 +2165,7 @@ static int rekey_exec(bContext *C, wmOperator *op)
data.totrekey= RNA_int_get(op->ptr, "keys_number");
foreach_selected_point(&data, rekey_particle);
-
+
recalc_lengths(data.edit);
PE_update_object(data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, data.ob);
@@ -2179,7 +2179,7 @@ void PARTICLE_OT_rekey(wmOperatorType *ot)
ot->name = "Rekey";
ot->idname = "PARTICLE_OT_rekey";
ot->description = "Change the number of keys of selected particles (root and tip keys included)";
-
+
/* api callbacks */
ot->exec = rekey_exec;
ot->invoke = WM_operator_props_popup;
@@ -2216,7 +2216,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
pa->flag |= PARS_REKEY;
key= new_keys= MEM_dupallocN(pa->hair);
-
+
/* interpolate new keys from old ones (roots stay the same) */
for (k=1, key++; k < pa->totkey; k++, key++) {
state.time= path_time * (float)k / (float)(pa->totkey-1);
@@ -2375,7 +2375,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
nhkey->editflag = hkey->editflag;
nhkey->time= hkey->time;
nhkey->weight= hkey->weight;
-
+
nkey->co= nhkey->co;
nkey->time= &nhkey->time;
/* these can be copied from old edit keys */
@@ -2394,7 +2394,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
if (point->keys)
MEM_freeN(point->keys);
-
+
pa->hair= new_hkeys;
point->keys= new_keys;
@@ -2439,7 +2439,7 @@ static void subdivide_particle(PEData *data, int pa_index)
nkey= new_keys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(HairKey)), "Hair subdivide keys");
nekey= new_ekeys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(PTCacheEditKey)), "Hair subdivide edit keys");
-
+
key = pa->hair;
endtime= key[pa->totkey-1].time;
@@ -2496,7 +2496,7 @@ static int subdivide_exec(bContext *C, wmOperator *UNUSED(op))
PE_set_data(C, &data);
foreach_point(&data, subdivide_particle);
-
+
recalc_lengths(data.edit);
PE_update_object(data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, data.ob);
@@ -2510,7 +2510,7 @@ void PARTICLE_OT_subdivide(wmOperatorType *ot)
ot->name = "Subdivide";
ot->idname = "PARTICLE_OT_subdivide";
ot->description = "Subdivide selected particles segments (adds keys)";
-
+
/* api callbacks */
ot->exec = subdivide_exec;
ot->poll = PE_hair_poll;
@@ -2545,7 +2545,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
removed= 0;
tree=BLI_kdtree_new(psys->totpart);
-
+
/* insert particles into kd tree */
LOOP_SELECTED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm_final, psys->part->from, psys->particles+p, mat);
@@ -2599,7 +2599,7 @@ void PARTICLE_OT_remove_doubles(wmOperatorType *ot)
ot->name = "Remove Doubles";
ot->idname = "PARTICLE_OT_remove_doubles";
ot->description = "Remove selected particles close enough of others";
-
+
/* api callbacks */
ot->exec = remove_doubles_exec;
ot->poll = PE_hair_poll;
@@ -2687,7 +2687,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
glutil_draw_lined_arc(0.0, M_PI*2.0, pe_brush_size_get(scene, brush), 40);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
-
+
glPopMatrix();
}
}
@@ -2757,7 +2757,7 @@ void PARTICLE_OT_delete(wmOperatorType *ot)
ot->name = "Delete";
ot->idname = "PARTICLE_OT_delete";
ot->description = "Delete selected particles or keys";
-
+
/* api callbacks */
ot->exec = delete_exec;
ot->invoke = WM_menu_invoke;
@@ -2850,7 +2850,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
}
edit->totpoint= psys->totpart= newtotpart;
-
+
/* create new elements */
newpa= psys->particles + totpart;
newpoint= edit->points + totpart;
@@ -2925,7 +2925,7 @@ static int mirror_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
-
+
PE_mirror_x(scene, ob, 0);
update_world_cos(ob, edit);
@@ -2941,7 +2941,7 @@ void PARTICLE_OT_mirror(wmOperatorType *ot)
ot->name = "Mirror";
ot->idname = "PARTICLE_OT_mirror";
ot->description = "Duplicate and mirror the selected particles along the local X axis";
-
+
/* api callbacks */
ot->exec = mirror_exec;
ot->poll = PE_hair_poll;
@@ -3000,7 +3000,7 @@ static void brush_cut(PEData *data, int pa_index)
o0= (float)data->mval[0];
o1= (float)data->mval[1];
-
+
xo0= x0 - o0;
xo1= x1 - o1;
@@ -3030,7 +3030,7 @@ static void brush_cut(PEData *data, int pa_index)
dv= v0*v0 + v1*v1;
d= (v0*xo1 - v1*xo0);
-
+
d= dv * rad2 - d*d;
if (d > 0.0f) {
@@ -3263,7 +3263,7 @@ static void BKE_brush_weight_get(PEData *data, float UNUSED(mat[4][4]), float UN
}
static void brush_smooth_get(PEData *data, float mat[4][4], float UNUSED(imat[4][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key)
-{
+{
if (key_index) {
float dvec[3];
@@ -3277,7 +3277,7 @@ static void brush_smooth_get(PEData *data, float mat[4][4], float UNUSED(imat[4]
static void brush_smooth_do(PEData *data, float UNUSED(mat[4][4]), float imat[4][4], int point_index, int key_index, PTCacheEditKey *key)
{
float vec[3], dvec[3];
-
+
if (key_index) {
copy_v3_v3(vec, data->vec);
mul_mat3_m4_v3(imat, vec);
@@ -3286,7 +3286,7 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[4][4]), float imat[4]
sub_v3_v3v3(dvec, vec, dvec);
mul_v3_fl(dvec, data->smoothfac);
-
+
add_v3_v3(key->co, dvec);
}
@@ -3323,7 +3323,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
int i, totface, intersect=0;
float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3], p_max[3];
float cur_ipoint[3];
-
+
if (dm == NULL) {
psys_disable_all(ob);
@@ -3339,7 +3339,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
/* BMESH_ONLY, deform dm may not have tessface */
DM_ensure_tessface(dm);
-
+
if (pa_minmax==0) {
INIT_MINMAX(p_min, p_max);
@@ -3509,7 +3509,7 @@ static int brush_add(PEData *data, short number)
mul_m4_v3(imat, co1);
mul_m4_v3(imat, co2);
min_d=2.0;
-
+
/* warning, returns the derived mesh face */
if (particle_intersect_dm(scene, ob, dm, 0, co1, co2, &min_d, &add_pars[n].num_dmcache, add_pars[n].fuv, 0, 0, 0, 0)) {
if (psys->part->use_modifier_stack && !psmd->dm_final->deformedOnly) {
@@ -3560,7 +3560,7 @@ static int brush_add(PEData *data, short number)
/* create tree for interpolation */
if (pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
tree=BLI_kdtree_new(psys->totpart);
-
+
for (i=0, pa=psys->particles; i<totpart; i++, pa++) {
psys_particle_on_dm(psmd->dm_final, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, cur_co, 0, 0, 0, 0, 0);
BLI_kdtree_insert(tree, i, cur_co);
@@ -3588,14 +3588,14 @@ static int brush_add(PEData *data, short number)
if (!(psys->flag & PSYS_GLOBAL_HAIR))
key->flag |= PEK_USE_WCO;
}
-
+
pa->size= 1.0f;
initialize_particle(&sim, pa);
reset_particle(&sim, pa, 0.0, 1.0);
point->flag |= PEP_EDIT_RECALC;
if (pe_x_mirror(ob))
point->flag |= PEP_TAG; /* signal for duplicate */
-
+
framestep= pa->lifetime/(float)(pset->totaddkey-1);
if (tree) {
@@ -3610,7 +3610,7 @@ static int brush_add(PEData *data, short number)
maxw = BLI_kdtree_find_nearest_n(tree, co1, ptn, 3);
maxd= ptn[maxw-1].dist;
-
+
for (w=0; w<maxw; w++) {
weight[w] = (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd));
totw += weight[w];
@@ -3637,10 +3637,10 @@ static int brush_add(PEData *data, short number)
key3[0].time= thkey->time/ 100.0f;
psys_get_particle_on_path(&sim, ptn[0].index, key3, 0);
mul_v3_fl(key3[0].co, weight[0]);
-
+
/* TODO: interpolating the weight would be nicer */
thkey->weight= (ppa->hair+MIN2(k, ppa->totkey-1))->weight;
-
+
if (maxw>1) {
key3[1].time= key3[0].time;
psys_get_particle_on_path(&sim, ptn[1].index, &key3[1], 0);
@@ -3684,7 +3684,7 @@ static int brush_add(PEData *data, short number)
MEM_freeN(add_pars);
BLI_rng_free(rng);
-
+
return n;
}
@@ -3712,7 +3712,7 @@ static int brush_edit_init(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
BrushEdit *bedit;
float min[3], max[3];
-
+
if (pset->brushtype < 0)
return 0;
@@ -3840,7 +3840,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
case PE_BRUSH_LENGTH:
{
data.mval= mval;
-
+
data.rad= pe_brush_size_get(scene, brush);
data.growfac= brush->strength / 50.0f;
@@ -4001,7 +4001,7 @@ static int brush_edit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
if (!brush_edit_init(C, op))
return OPERATOR_CANCELLED;
-
+
brush_edit_apply_event(C, op, event);
WM_event_add_modal_handler(C, op);
@@ -4036,7 +4036,7 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot)
ot->name = "Brush Edit";
ot->idname = "PARTICLE_OT_brush_edit";
ot->description = "Apply a stroke of brush to the particles";
-
+
/* api callbacks */
ot->exec = brush_edit_exec;
ot->invoke = brush_edit_invoke;
@@ -4060,12 +4060,12 @@ static int shape_cut_poll(bContext *C)
if (PE_hair_poll(C)) {
Scene *scene = CTX_data_scene(C);
ParticleEditSettings *pset = PE_settings(scene);
-
+
if (pset->shape_object && (pset->shape_object->type == OB_MESH)) {
return true;
}
}
-
+
return false;
}
@@ -4077,9 +4077,9 @@ typedef struct PointInsideBVH {
static void point_inside_bvh_cb(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
{
PointInsideBVH *data = userdata;
-
+
data->bvhdata.raycast_callback(&data->bvhdata, index, ray, hit);
-
+
if (hit->index != -1)
++data->num_hits;
}
@@ -4090,14 +4090,14 @@ static bool shape_cut_test_point(PEData *data, ParticleCacheKey *key)
BVHTreeFromMesh *shape_bvh = &data->shape_bvh;
const float dir[3] = {1.0f, 0.0f, 0.0f};
PointInsideBVH userdata;
-
+
userdata.bvhdata = data->shape_bvh;
userdata.num_hits = 0;
-
+
BLI_bvhtree_ray_cast_all(
shape_bvh->tree, key->co, dir, 0.0f, BVH_RAYCAST_DIST_MAX,
point_inside_bvh_cb, &userdata);
-
+
/* for any point inside a watertight mesh the number of hits is uneven */
return (userdata.num_hits % 2) == 1;
}
@@ -4108,17 +4108,17 @@ static void shape_cut(PEData *data, int pa_index)
Object *ob = data->ob;
ParticleEditSettings *pset = PE_settings(data->scene);
ParticleCacheKey *key;
-
+
bool cut;
float cut_time = 1.0;
int k, totkeys = 1 << pset->draw_step;
-
+
/* don't cut hidden */
if (edit->points[pa_index].flag & PEP_HIDE)
return;
-
+
cut = false;
-
+
/* check if root is inside the cut shape */
key = edit->pathcache[pa_index];
if (!shape_cut_test_point(data, key)) {
@@ -4130,10 +4130,10 @@ static void shape_cut(PEData *data, int pa_index)
BVHTreeRayHit hit;
float dir[3];
float len;
-
+
sub_v3_v3v3(dir, (key+1)->co, key->co);
len = normalize_v3(dir);
-
+
memset(&hit, 0, sizeof(hit));
hit.index = -1;
hit.dist = len;
@@ -4168,32 +4168,32 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op))
Object *shapeob = pset->shape_object;
int selected = count_selected_keys(scene, edit);
int lock_root = pset->flag & PE_LOCK_FIRST;
-
+
if (!PE_start_edit(edit))
return OPERATOR_CANCELLED;
-
+
/* disable locking temporatily for disconnected hair */
if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
pset->flag &= ~PE_LOCK_FIRST;
-
+
if (edit->psys && edit->pathcache) {
PEData data;
int removed;
-
+
PE_set_data(C, &data);
if (!PE_create_shape_tree(&data, shapeob)) {
/* shapeob may not have faces... */
return OPERATOR_CANCELLED;
}
-
+
if (selected)
foreach_selected_point(&data, shape_cut);
else
foreach_point(&data, shape_cut);
-
+
removed = remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob));
recalc_lengths(edit);
-
+
if (removed) {
update_world_cos(ob, edit);
psys_free_path_cache(NULL, edit);
@@ -4201,7 +4201,7 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op))
}
else
PE_update_object(scene, ob, 1);
-
+
if (edit->psys) {
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
}
@@ -4209,12 +4209,12 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op))
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
}
-
+
PE_free_shape_tree(&data);
}
-
+
pset->flag |= lock_root;
-
+
return OPERATOR_FINISHED;
}
@@ -4224,7 +4224,7 @@ void PARTICLE_OT_shape_cut(wmOperatorType *ot)
ot->name = "Shape Cut";
ot->idname = "PARTICLE_OT_shape_cut";
ot->description = "Cut hair to conform to the set shape object";
-
+
/* api callbacks */
ot->exec = shape_cut_exec;
ot->poll = shape_cut_poll;
@@ -4413,12 +4413,12 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
PTCacheEdit *edit;
ob->mode |= mode_flag;
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);
}
@@ -4439,7 +4439,7 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot)
ot->name = "Particle Edit Toggle";
ot->idname = "PARTICLE_OT_particle_edit_toggle";
ot->description = "Toggle particle edit mode";
-
+
/* api callbacks */
ot->exec = particle_edit_toggle_exec;
ot->poll = particle_edit_toggle_poll;
@@ -4455,7 +4455,7 @@ static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_active_object(C);
ParticleSystem *psys = psys_get_current(ob);
-
+
if (psys->edit) {
if (psys->edit->edited || 1) {
PE_free_ptcache_edit(psys->edit);
@@ -4494,7 +4494,7 @@ void PARTICLE_OT_edited_clear(wmOperatorType *ot)
ot->name = "Clear Edited";
ot->idname = "PARTICLE_OT_edited_clear";
ot->description = "Undo all edition performed on the particle system";
-
+
/* api callbacks */
ot->exec = clear_edited_exec;
ot->poll = particle_edit_toggle_poll;