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:
authorJanne Karhu <jhkarh@gmail.com>2009-09-11 02:32:33 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-09-11 02:32:33 +0400
commite9587a89faf33aa0c1383b59f006be4cc7443a5a (patch)
treebfa5264b90b75a58912448eb3d589b188cbd0472 /source/blender/editors/space_buttons
parentfcc5884c252ae10b07a6f8c5e1c5990e9aa4e7c5 (diff)
Hair dynamics with cloth simulation
- Hair dynamics have their own panel in particle settings with the settings from cloth panel that apply to hair. - Basic internal friction force to quickly emulate self collisions and volume preservation. (Still very early code, but gives some idea of what's possible). - Softbody simulation is no longer used for hair. * Old files with sb dynamics should just load the hair without dynamics so new dynamics can be applied. * Invasion of particles exceptions in sb code is finally over. - Collisions with other objects are disabled for now and will be worked out in the future. Other changes/fixes: - Particle mode editing flag wasn't saved properly. - Some old files with edited hair didn't load correctly. - Disabled delete & specials menu in particle mode for non-hair editing. - Fixed yet one more cloth & softbody pointcache update issue. - Disconnect/connect hair now uses only the deformed mesh so it works correctly also for subsurfed emitters. - Hair editing now updates correctly with a moving emitter.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 0df6f6250ff..bc9b05dc12e 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -54,6 +54,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
+#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
@@ -728,6 +729,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
PTCacheEdit *edit = psys->edit;
PTCacheEditPoint *point = edit ? edit->points : NULL;
PTCacheEditKey *ekey = NULL;
+ DerivedMesh *dm = NULL;
HairKey *key;
int i, k;
float hairmat[4][4];
@@ -738,13 +740,18 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
if(!psys->part || psys->part->type != PART_HAIR)
return;
+ if(psmd->dm->deformedOnly)
+ dm= psmd->dm;
+ else
+ dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
+
for(i=0; i<psys->totpart; i++,pa++) {
if(point) {
ekey = point->keys;
point++;
}
- psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
+ psys_mat_hair_to_global(ob, dm, psys->part->from, pa, hairmat);
for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
Mat4MulVecfl(hairmat,key->co);
@@ -758,6 +765,9 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys_free_path_cache(psys, psys->edit);
+ if(!psmd->dm->deformedOnly)
+ dm->release(dm);
+
psys->flag |= PSYS_GLOBAL_HAIR;
PE_update_object(scene, ob, 0);
@@ -814,8 +824,8 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
BVHTreeFromMesh bvhtree;
BVHTreeNearest nearest;
MFace *mface;
- DerivedMesh *dm = CDDM_copy(psmd->dm);
- int numverts = dm->getNumVerts (dm);
+ DerivedMesh *dm = NULL;
+ int numverts;
int i, k;
float hairmat[4][4], imat[4][4];
float v[4][3], vec[3];
@@ -823,6 +833,13 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
if(!psys || !psys->part || psys->part->type != PART_HAIR)
return;
+ if(psmd->dm->deformedOnly)
+ dm= psmd->dm;
+ else
+ dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
+
+ numverts = dm->getNumVerts (dm);
+
memset( &bvhtree, 0, sizeof(bvhtree) );
/* convert to global coordinates */
@@ -881,7 +898,8 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
}
free_bvhtree_from_mesh(&bvhtree);
- dm->release(dm);
+ if(!psmd->dm->deformedOnly)
+ dm->release(dm);
psys_free_path_cache(psys, psys->edit);