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-06-21 15:09:16 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-06-21 15:09:16 +0400
commit1f9368b37ec9a418cd8996ffd9ee24f4bd47b2dd (patch)
tree8bdb6594c65e22a07a528d44090265f380bf404e /source/blender
parentc549e75c1690dd740540d1349593983ae6dd08d9 (diff)
Particle system parenting
* Allows moving, rotating & scaling of particle simulations. * Setting in particle render options. * Changes viewed & rendered particles from global space to parent space. * Doesn't effect simulations at all.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c3
-rw-r--r--source/blender/makesdna/DNA_particle_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_particle.c8
-rw-r--r--source/blender/render/intern/source/convertblender.c3
4 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index a67e8c8a1c3..42da6775d5f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3239,6 +3239,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(draw_as!=PART_DRAW_PATH){
state.time=cfra;
if(psys_get_particle_state(scene,ob,psys,a,&state,0)){
+ if(psys->parent)
+ Mat4MulVecfl(psys->parent->obmat, state.co);
+
/* create actiual particle data */
switch(draw_as){
case PART_DRAW_DOT:
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 6805082d094..b10f35b9091 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -192,6 +192,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
struct Object *target_ob;
struct Object *keyed_ob;
struct Object *lattice;
+ struct Object *parent; /* particles from global space -> parent space */
struct ListBase effectors, reactevents; /* runtime */
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 2c4c75e45eb..c48c1006588 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -1715,6 +1715,14 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ /* offset ob */
+ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "parent");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
}
void RNA_def_particle(BlenderRNA *brna)
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 98e5819c0d3..8423b5d271c 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1886,6 +1886,9 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if(psys_get_particle_state(re->scene,ob,psys,a,&state,0)==0)
continue;
+ if(psys->parent)
+ Mat4MulVecfl(psys->parent->obmat, state.co);
+
VECCOPY(loc,state.co);
if(part->ren_as!=PART_DRAW_BB)
MTC_Mat4MulVecfl(re->viewmat,loc);